mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 21:10:42 +00:00
MTLDevice wrapping for feature supported APIs
These APIs are not serialized and pass through to real device One exception is ray tracing related support APIs return false ie. supportsRaytracing supportsRaytracingFromRender
This commit is contained in:
committed by
Baldur Karlsson
parent
4e240a4153
commit
823ecdbbf7
@@ -48,6 +48,8 @@ WrappedMTLDevice *WrappedMTLDevice::MTLCreateSystemDefaultDevice(MTL::Device *re
|
||||
return wrappedMTLDevice;
|
||||
}
|
||||
|
||||
// Serialised MTLDevice APIs
|
||||
|
||||
template <typename SerialiserType>
|
||||
bool WrappedMTLDevice::Serialise_newCommandQueue(SerialiserType &ser, WrappedMTLCommandQueue *queue)
|
||||
{
|
||||
@@ -187,6 +189,137 @@ WrappedMTLLibrary *WrappedMTLDevice::newLibraryWithSource(NS::String *source,
|
||||
return wrappedMTLLibrary;
|
||||
}
|
||||
|
||||
// Non-Serialised MTLDevice APIs
|
||||
|
||||
bool WrappedMTLDevice::isDepth24Stencil8PixelFormatSupported()
|
||||
{
|
||||
return Unwrap(this)->depth24Stencil8PixelFormatSupported();
|
||||
}
|
||||
|
||||
MTL::ReadWriteTextureTier WrappedMTLDevice::readWriteTextureSupport()
|
||||
{
|
||||
return Unwrap(this)->readWriteTextureSupport();
|
||||
}
|
||||
|
||||
MTL::ArgumentBuffersTier WrappedMTLDevice::argumentBuffersSupport()
|
||||
{
|
||||
return Unwrap(this)->argumentBuffersSupport();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::areRasterOrderGroupsSupported()
|
||||
{
|
||||
return Unwrap(this)->rasterOrderGroupsSupported();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supports32BitFloatFiltering()
|
||||
{
|
||||
return Unwrap(this)->supports32BitFloatFiltering();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supports32BitMSAA()
|
||||
{
|
||||
return Unwrap(this)->supports32BitMSAA();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsQueryTextureLOD()
|
||||
{
|
||||
return Unwrap(this)->supportsQueryTextureLOD();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsBCTextureCompression()
|
||||
{
|
||||
return Unwrap(this)->supportsBCTextureCompression();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsPullModelInterpolation()
|
||||
{
|
||||
return Unwrap(this)->supportsPullModelInterpolation();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::areBarycentricCoordsSupported()
|
||||
{
|
||||
return Unwrap(this)->barycentricCoordsSupported();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsShaderBarycentricCoordinates()
|
||||
{
|
||||
return Unwrap(this)->supportsShaderBarycentricCoordinates();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsFeatureSet(MTL::FeatureSet featureSet)
|
||||
{
|
||||
return Unwrap(this)->supportsFeatureSet(featureSet);
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsFamily(MTL::GPUFamily gpuFamily)
|
||||
{
|
||||
return Unwrap(this)->supportsFamily(gpuFamily);
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsTextureSampleCount(NS::UInteger sampleCount)
|
||||
{
|
||||
return Unwrap(this)->supportsTextureSampleCount(sampleCount);
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::areProgrammableSamplePositionsSupported()
|
||||
{
|
||||
return Unwrap(this)->programmableSamplePositionsSupported();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsRasterizationRateMapWithLayerCount(NS::UInteger layerCount)
|
||||
{
|
||||
return Unwrap(this)->supportsRasterizationRateMap(layerCount);
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsCounterSampling(MTL::CounterSamplingPoint samplingPoint)
|
||||
{
|
||||
return Unwrap(this)->supportsCounterSampling(samplingPoint);
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsVertexAmplificationCount(NS::UInteger count)
|
||||
{
|
||||
return Unwrap(this)->supportsVertexAmplificationCount(count);
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsDynamicLibraries()
|
||||
{
|
||||
return Unwrap(this)->supportsDynamicLibraries();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsRenderDynamicLibraries()
|
||||
{
|
||||
return Unwrap(this)->supportsRenderDynamicLibraries();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsRaytracing()
|
||||
{
|
||||
// RD device does not support ray tracing
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsFunctionPointers()
|
||||
{
|
||||
return Unwrap(this)->supportsFunctionPointers();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsFunctionPointersFromRender()
|
||||
{
|
||||
return Unwrap(this)->supportsFunctionPointersFromRender();
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsRaytracingFromRender()
|
||||
{
|
||||
// RD device does not support ray tracing
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WrappedMTLDevice::supportsPrimitiveMotionBlur()
|
||||
{
|
||||
return Unwrap(this)->supportsPrimitiveMotionBlur();
|
||||
}
|
||||
|
||||
// End of MTLDevice APIs
|
||||
|
||||
INSTANTIATE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLDevice, WrappedMTLCommandQueue *,
|
||||
newCommandQueue);
|
||||
INSTANTIATE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLDevice, WrappedMTLLibrary *, newDefaultLibrary);
|
||||
|
||||
@@ -36,11 +36,39 @@ public:
|
||||
~WrappedMTLDevice() {}
|
||||
static WrappedMTLDevice *MTLCreateSystemDefaultDevice(MTL::Device *realMTLDevice);
|
||||
|
||||
// Serialised MTLDevice APIs
|
||||
DECLARE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLCommandQueue *, newCommandQueue);
|
||||
DECLARE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLLibrary *, newDefaultLibrary);
|
||||
DECLARE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLLibrary *, newLibraryWithSource,
|
||||
NS::String *source, MTL::CompileOptions *options,
|
||||
NS::Error **error);
|
||||
// Non-Serialised MTLDevice APIs
|
||||
bool isDepth24Stencil8PixelFormatSupported();
|
||||
MTL::ReadWriteTextureTier readWriteTextureSupport();
|
||||
MTL::ArgumentBuffersTier argumentBuffersSupport();
|
||||
bool areRasterOrderGroupsSupported();
|
||||
bool supports32BitFloatFiltering();
|
||||
bool supports32BitMSAA();
|
||||
bool supportsQueryTextureLOD();
|
||||
bool supportsBCTextureCompression();
|
||||
bool supportsPullModelInterpolation();
|
||||
bool areBarycentricCoordsSupported();
|
||||
bool supportsShaderBarycentricCoordinates();
|
||||
bool supportsFeatureSet(MTL::FeatureSet featureSet);
|
||||
bool supportsFamily(MTL::GPUFamily gpuFamily);
|
||||
bool supportsTextureSampleCount(NS::UInteger sampleCount);
|
||||
bool areProgrammableSamplePositionsSupported();
|
||||
bool supportsRasterizationRateMapWithLayerCount(NS::UInteger layerCount);
|
||||
bool supportsCounterSampling(MTL::CounterSamplingPoint samplingPoint);
|
||||
bool supportsVertexAmplificationCount(NS::UInteger count);
|
||||
bool supportsDynamicLibraries();
|
||||
bool supportsRenderDynamicLibraries();
|
||||
bool supportsRaytracing();
|
||||
bool supportsFunctionPointers();
|
||||
bool supportsFunctionPointersFromRender();
|
||||
bool supportsRaytracingFromRender();
|
||||
bool supportsPrimitiveMotionBlur();
|
||||
// End of MTLDevice APIs
|
||||
|
||||
CaptureState &GetStateRef() { return m_State; }
|
||||
CaptureState GetState() { return m_State; }
|
||||
|
||||
@@ -128,37 +128,37 @@
|
||||
- (BOOL)isDepth24Stencil8PixelFormatSupported API_AVAILABLE(macos(10.11), macCatalyst(13.0))
|
||||
API_UNAVAILABLE(ios)
|
||||
{
|
||||
return self.real.depth24Stencil8PixelFormatSupported;
|
||||
return self.wrappedCPP->isDepth24Stencil8PixelFormatSupported();
|
||||
}
|
||||
|
||||
- (MTLReadWriteTextureTier)readWriteTextureSupport API_AVAILABLE(macos(10.13), ios(11.0))
|
||||
{
|
||||
return self.real.readWriteTextureSupport;
|
||||
return (MTLReadWriteTextureTier)self.wrappedCPP->readWriteTextureSupport();
|
||||
}
|
||||
|
||||
- (MTLArgumentBuffersTier)argumentBuffersSupport API_AVAILABLE(macos(10.13), ios(11.0))
|
||||
{
|
||||
return self.real.argumentBuffersSupport;
|
||||
return (MTLArgumentBuffersTier)self.wrappedCPP->argumentBuffersSupport();
|
||||
}
|
||||
|
||||
- (BOOL)areRasterOrderGroupsSupported API_AVAILABLE(macos(10.13), ios(11.0))
|
||||
{
|
||||
return self.real.areRasterOrderGroupsSupported;
|
||||
return self.wrappedCPP->areRasterOrderGroupsSupported();
|
||||
}
|
||||
|
||||
- (BOOL)supports32BitFloatFiltering API_AVAILABLE(macos(11.0), ios(14.0))
|
||||
{
|
||||
return self.real.supports32BitFloatFiltering;
|
||||
return self.wrappedCPP->supports32BitFloatFiltering();
|
||||
}
|
||||
|
||||
- (BOOL)supports32BitMSAA API_AVAILABLE(macos(11.0), ios(14.0))
|
||||
{
|
||||
return self.real.supports32BitMSAA;
|
||||
return self.wrappedCPP->supports32BitMSAA();
|
||||
}
|
||||
|
||||
- (BOOL)supportsQueryTextureLOD API_AVAILABLE(macos(11.0), ios(14.0))
|
||||
{
|
||||
return self.real.supportsQueryTextureLOD;
|
||||
return self.wrappedCPP->supportsQueryTextureLOD();
|
||||
}
|
||||
|
||||
- (BOOL)supportsBCTextureCompression API_AVAILABLE(macos(11.0))
|
||||
@@ -167,22 +167,21 @@
|
||||
API_UNAVAILABLE(ios)
|
||||
#endif // #if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0
|
||||
{
|
||||
return self.real.supportsBCTextureCompression;
|
||||
return self.wrappedCPP->supportsBCTextureCompression();
|
||||
}
|
||||
|
||||
- (BOOL)supportsPullModelInterpolation API_AVAILABLE(macos(11.0), ios(14.0))
|
||||
{
|
||||
return self.real.supportsPullModelInterpolation;
|
||||
return self.wrappedCPP->supportsPullModelInterpolation();
|
||||
}
|
||||
|
||||
- (BOOL)areBarycentricCoordsSupported API_AVAILABLE(macos(10.15))API_UNAVAILABLE(ios)
|
||||
{
|
||||
return self.real.barycentricCoordsSupported;
|
||||
return self.wrappedCPP->areBarycentricCoordsSupported();
|
||||
}
|
||||
|
||||
- (BOOL)supportsShaderBarycentricCoordinates API_AVAILABLE(macos(10.15))API_UNAVAILABLE(ios)
|
||||
{
|
||||
return self.real.supportsShaderBarycentricCoordinates;
|
||||
return self.wrappedCPP->supportsShaderBarycentricCoordinates();
|
||||
}
|
||||
|
||||
- (NSUInteger)currentAllocatedSize API_AVAILABLE(macos(10.13), ios(11.0))
|
||||
@@ -478,20 +477,17 @@ newComputePipelineStateWithDescriptor:(MTLComputePipelineDescriptor *)descriptor
|
||||
|
||||
- (BOOL)supportsFeatureSet:(MTLFeatureSet)featureSet
|
||||
{
|
||||
METAL_NOT_HOOKED();
|
||||
return [self.real supportsFeatureSet:featureSet];
|
||||
return self.wrappedCPP->supportsFeatureSet((MTL::FeatureSet)featureSet);
|
||||
}
|
||||
|
||||
- (BOOL)supportsFamily:(MTLGPUFamily)gpuFamily API_AVAILABLE(macos(10.15), ios(13.0))
|
||||
{
|
||||
METAL_NOT_HOOKED();
|
||||
return [self.real supportsFamily:gpuFamily];
|
||||
return self.wrappedCPP->supportsFamily((MTL::GPUFamily)gpuFamily);
|
||||
}
|
||||
|
||||
- (BOOL)supportsTextureSampleCount:(NSUInteger)sampleCount API_AVAILABLE(macos(10.11), ios(9.0))
|
||||
{
|
||||
METAL_NOT_HOOKED();
|
||||
return [self.real supportsTextureSampleCount:sampleCount];
|
||||
return self.wrappedCPP->supportsTextureSampleCount(sampleCount);
|
||||
}
|
||||
|
||||
- (NSUInteger)minimumLinearTextureAlignmentForPixelFormat:(MTLPixelFormat)format
|
||||
@@ -546,7 +542,7 @@ newRenderPipelineStateWithTileDescriptor:(MTLTileRenderPipelineDescriptor *)desc
|
||||
|
||||
- (BOOL)areProgrammableSamplePositionsSupported API_AVAILABLE(macos(10.13), ios(11.0))
|
||||
{
|
||||
return self.real.programmableSamplePositionsSupported;
|
||||
return self.wrappedCPP->areProgrammableSamplePositionsSupported();
|
||||
}
|
||||
|
||||
- (void)getDefaultSamplePositions:(MTLSamplePosition *)positions
|
||||
@@ -566,8 +562,7 @@ newRenderPipelineStateWithTileDescriptor:(MTLTileRenderPipelineDescriptor *)desc
|
||||
- (BOOL)supportsRasterizationRateMapWithLayerCount:(NSUInteger)layerCount
|
||||
API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4))
|
||||
{
|
||||
METAL_NOT_HOOKED();
|
||||
return [self.real supportsRasterizationRateMapWithLayerCount:layerCount];
|
||||
return self.wrappedCPP->supportsRasterizationRateMapWithLayerCount(layerCount);
|
||||
}
|
||||
|
||||
- (nullable id<MTLRasterizationRateMap>)newRasterizationRateMapWithDescriptor:
|
||||
@@ -697,26 +692,24 @@ newIndirectCommandBufferWithDescriptor:(MTLIndirectCommandBufferDescriptor *)des
|
||||
- (BOOL)supportsCounterSampling:(MTLCounterSamplingPoint)samplingPoint
|
||||
API_AVAILABLE(macos(11.0), ios(14.0))
|
||||
{
|
||||
METAL_NOT_HOOKED();
|
||||
return [self.real supportsCounterSampling:samplingPoint];
|
||||
return self.wrappedCPP->supportsCounterSampling((MTL::CounterSamplingPoint)samplingPoint);
|
||||
}
|
||||
|
||||
- (BOOL)supportsVertexAmplificationCount:(NSUInteger)count
|
||||
API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4))
|
||||
{
|
||||
METAL_NOT_HOOKED();
|
||||
return [self.real supportsVertexAmplificationCount:count];
|
||||
return self.wrappedCPP->supportsVertexAmplificationCount(count);
|
||||
}
|
||||
|
||||
- (BOOL)supportsDynamicLibraries API_AVAILABLE(macos(11.0), ios(14.0))
|
||||
{
|
||||
return self.real.supportsDynamicLibraries;
|
||||
return self.wrappedCPP->supportsDynamicLibraries();
|
||||
}
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0
|
||||
- (BOOL)supportsRenderDynamicLibraries API_AVAILABLE(macos(12.0), ios(15.0))
|
||||
{
|
||||
return self.real.supportsRenderDynamicLibraries;
|
||||
return self.wrappedCPP->supportsRenderDynamicLibraries();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -746,7 +739,7 @@ newIndirectCommandBufferWithDescriptor:(MTLIndirectCommandBufferDescriptor *)des
|
||||
|
||||
- (BOOL)supportsRaytracing API_AVAILABLE(macos(11.0), ios(14.0))
|
||||
{
|
||||
return self.real.supportsRaytracing;
|
||||
return self.wrappedCPP->supportsRaytracing();
|
||||
}
|
||||
|
||||
- (MTLAccelerationStructureSizes)accelerationStructureSizesWithDescriptor:
|
||||
@@ -772,20 +765,20 @@ newIndirectCommandBufferWithDescriptor:(MTLIndirectCommandBufferDescriptor *)des
|
||||
|
||||
- (BOOL)supportsFunctionPointers API_AVAILABLE(macos(11.0), ios(14.0))
|
||||
{
|
||||
return self.real.supportsFunctionPointers;
|
||||
return self.wrappedCPP->supportsFunctionPointers();
|
||||
}
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0
|
||||
- (BOOL)supportsFunctionPointersFromRender API_AVAILABLE(macos(12.0), ios(15.0))
|
||||
{
|
||||
return self.real.supportsFunctionPointersFromRender;
|
||||
return self.wrappedCPP->supportsFunctionPointersFromRender();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0
|
||||
- (BOOL)supportsRaytracingFromRender API_AVAILABLE(macos(12.0), ios(15.0))
|
||||
{
|
||||
return self.real.supportsRaytracingFromRender;
|
||||
return self.wrappedCPP->supportsRaytracingFromRender();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -794,7 +787,7 @@ newIndirectCommandBufferWithDescriptor:(MTLIndirectCommandBufferDescriptor *)des
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0
|
||||
- (BOOL)supportsPrimitiveMotionBlur API_AVAILABLE(macos(11.0), ios(14.0))
|
||||
{
|
||||
return self.real.supportsPrimitiveMotionBlur;
|
||||
return self.wrappedCPP->supportsPrimitiveMotionBlur();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user