From 6f5b849f45dc9840e6f932ac85c37bfe0e654ffa Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Mon, 10 Apr 2023 07:15:37 +0100 Subject: [PATCH] Update Metal wrapped objects to match MacOS13.3 MTLDevice changes Change API availability: supportsBCTextureCompression : API_AVAILABLE(macos(11.0), ios(16.4)) Added protocols: - (BOOL)shouldMaximizeConcurrentCompilation API_AVAILABLE(macos(13.3)) API_UNAVAILABLE(ios) - (void)setShouldMaximizeConcurrentCompilation:(BOOL)value API_AVAILABLE(macos(13.3))API_UNAVAILABLE(ios) -(NSUInteger)maximumConcurrentCompilationTaskCount API_AVAILABLE(macos(13.3)) API_UNAVAILABLE(ios) MTLFunction changes Change API availability: newArgumentEncoderWithBufferIndex : API_DEPRECATED("Use MTLDevice's newArgumentEncoderWithBufferBinding: instead", macos(10.13, 13.0), ios(11.0, 16.0)) Added: bool WrappedMTLDevice::shouldMaximizeConcurrentCompilation(); NS::UInteger WrappedMTLDevice::maximumConcurrentCompilationTaskCount(); --- renderdoc/driver/metal/metal_device.cpp | 10 ++++++++ renderdoc/driver/metal/metal_device.h | 2 ++ renderdoc/driver/metal/metal_device_bridge.mm | 25 ++++++++++++++++++- .../driver/metal/metal_function_bridge.mm | 3 ++- renderdoc/driver/metal/metal_types_bridge.h | 4 +++ 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/metal/metal_device.cpp b/renderdoc/driver/metal/metal_device.cpp index 21ac4fc37..87b298fba 100644 --- a/renderdoc/driver/metal/metal_device.cpp +++ b/renderdoc/driver/metal/metal_device.cpp @@ -647,6 +647,16 @@ bool WrappedMTLDevice::supportsPrimitiveMotionBlur() return Unwrap(this)->supportsPrimitiveMotionBlur(); } +bool WrappedMTLDevice::shouldMaximizeConcurrentCompilation() +{ + return Unwrap(this)->shouldMaximizeConcurrentCompilation(); +} + +NS::UInteger WrappedMTLDevice::maximumConcurrentCompilationTaskCount() +{ + return Unwrap(this)->maximumConcurrentCompilationTaskCount(); +} + // End of MTLDevice APIs WrappedMTLTexture *WrappedMTLDevice::Common_NewTexture(RDMTL::TextureDescriptor &descriptor, diff --git a/renderdoc/driver/metal/metal_device.h b/renderdoc/driver/metal/metal_device.h index a404973d2..5d3b3fe30 100644 --- a/renderdoc/driver/metal/metal_device.h +++ b/renderdoc/driver/metal/metal_device.h @@ -105,6 +105,8 @@ public: bool supportsFunctionPointersFromRender(); bool supportsRaytracingFromRender(); bool supportsPrimitiveMotionBlur(); + bool shouldMaximizeConcurrentCompilation(); + NS::UInteger maximumConcurrentCompilationTaskCount(); // End of MTLDevice APIs CaptureState &GetStateRef() { return m_State; } diff --git a/renderdoc/driver/metal/metal_device_bridge.mm b/renderdoc/driver/metal/metal_device_bridge.mm index 28aa3b2d3..308e92c0f 100644 --- a/renderdoc/driver/metal/metal_device_bridge.mm +++ b/renderdoc/driver/metal/metal_device_bridge.mm @@ -160,7 +160,7 @@ return GetWrapped(self)->supportsQueryTextureLOD(); } -- (BOOL)supportsBCTextureCompression API_AVAILABLE(macos(11.0))API_UNAVAILABLE(ios) +- (BOOL)supportsBCTextureCompression API_AVAILABLE(macos(11.0), ios(16.4)) { return GetWrapped(self)->supportsBCTextureCompression(); } @@ -889,4 +889,27 @@ newIndirectCommandBufferWithDescriptor:(MTLIndirectCommandBufferDescriptor *)des return GetWrapped(self)->supportsPrimitiveMotionBlur(); } +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_13_3 +- (BOOL)shouldMaximizeConcurrentCompilation API_AVAILABLE(macos(13.3))API_UNAVAILABLE(ios) +{ + return GetWrapped(self)->shouldMaximizeConcurrentCompilation(); +} +#endif + +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_13_3 +- (void)setShouldMaximizeConcurrentCompilation:(BOOL)value API_AVAILABLE(macos(13.3)) + API_UNAVAILABLE(ios) +{ + METAL_NOT_HOOKED(); + return [self.real setShouldMaximizeConcurrentCompilation:value]; +} +#endif + +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_13_3 +- (NSUInteger)maximumConcurrentCompilationTaskCount API_AVAILABLE(macos(13.3))API_UNAVAILABLE(ios) +{ + return GetWrapped(self)->maximumConcurrentCompilationTaskCount(); +} +#endif + @end diff --git a/renderdoc/driver/metal/metal_function_bridge.mm b/renderdoc/driver/metal/metal_function_bridge.mm index b55e0a60a..c579a5c38 100644 --- a/renderdoc/driver/metal/metal_function_bridge.mm +++ b/renderdoc/driver/metal/metal_function_bridge.mm @@ -117,7 +117,8 @@ } - (id)newArgumentEncoderWithBufferIndex:(NSUInteger)bufferIndex - API_AVAILABLE(macos(10.13), ios(11.0)) + API_DEPRECATED("Use MTLDevice's newArgumentEncoderWithBufferBinding: instead", + macos(10.13, 13.0), ios(11.0, 16.0)) { METAL_NOT_HOOKED(); return [self.real newArgumentEncoderWithBufferIndex:bufferIndex]; diff --git a/renderdoc/driver/metal/metal_types_bridge.h b/renderdoc/driver/metal/metal_types_bridge.h index 6f92c78ea..0cd6f97b0 100644 --- a/renderdoc/driver/metal/metal_types_bridge.h +++ b/renderdoc/driver/metal/metal_types_bridge.h @@ -63,3 +63,7 @@ inline WrappedMTLResource *GetWrapped(id objC) #ifndef __MAC_13_0 #define __MAC_13_0 130000 #endif + +#ifndef __MAC_13_3 +#define __MAC_13_3 130300 +#endif