Metal compile fixes when compiling with MacOS SDK 14 (Xcode 15)

Update wrapped protocols to match MacOS SDK 14 declarations
This commit is contained in:
Jake Turner
2023-09-30 12:32:34 +01:00
parent f36d8a3b23
commit a60412d4f6
3 changed files with 85 additions and 6 deletions
+34 -5
View File
@@ -66,7 +66,7 @@
}
// MTLDevice : based on the protocol defined in
// Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLDevice.h
// Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLDevice.h
- (NSString *)name
{
@@ -78,6 +78,13 @@
return self.real.registryID;
}
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_14_0
- (MTLArchitecture *)architecture API_AVAILABLE(macos(14.0), ios(17.0))
{
return self.real.architecture;
}
#endif
- (MTLSize)maxThreadsPerThreadgroup API_AVAILABLE(macos(10.11), ios(9.0))
{
return self.real.maxThreadsPerThreadgroup;
@@ -103,8 +110,7 @@
return self.real.hasUnifiedMemory;
}
- (uint64_t)recommendedMaxWorkingSetSize API_AVAILABLE(macos(10.12), macCatalyst(13.0))
API_UNAVAILABLE(ios)
- (uint64_t)recommendedMaxWorkingSetSize API_AVAILABLE(macos(10.12), macCatalyst(13.0), ios(16.0))
{
return self.real.recommendedMaxWorkingSetSize;
}
@@ -648,7 +654,8 @@
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_13_0
- (nullable id<MTLIOFileHandle>)newIOHandleWithURL:(NSURL *)url
error:(NSError **)error
API_AVAILABLE(macos(13.0), ios(16.0))
API_DEPRECATED_WITH_REPLACEMENT("Use newIOFileHandleWithURL:error: instead", macos(13.0, 14.0),
ios(16.0, 17.0))
{
METAL_NOT_HOOKED();
return [self.real newIOHandleWithURL:url error:error];
@@ -669,13 +676,35 @@
- (nullable id<MTLIOFileHandle>)newIOHandleWithURL:(NSURL *)url
compressionMethod:(MTLIOCompressionMethod)compressionMethod
error:(NSError **)error
API_AVAILABLE(macos(13.0), ios(16.0))
API_DEPRECATED_WITH_REPLACEMENT("Use newIOFileHandleWithURL:compressionMethod:error: instead",
macos(13.0, 14.0), ios(16.0, 17.0))
{
METAL_NOT_HOOKED();
return [self.real newIOHandleWithURL:url compressionMethod:compressionMethod error:error];
}
#endif
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_14_0
- (nullable id<MTLIOFileHandle>)newIOFileHandleWithURL:(NSURL *)url
error:(NSError **)error
API_AVAILABLE(macos(14.0), ios(17.0))
{
METAL_NOT_HOOKED();
return [self.real newIOFileHandleWithURL:url error:error];
}
#endif
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_14_0
- (nullable id<MTLIOFileHandle>)newIOFileHandleWithURL:(NSURL *)url
compressionMethod:(MTLIOCompressionMethod)compressionMethod
error:(NSError **)error
API_AVAILABLE(macos(14.0), ios(17.0))
{
METAL_NOT_HOOKED();
return [self.real newIOFileHandleWithURL:url compressionMethod:compressionMethod error:error];
}
#endif
- (MTLSize)sparseTileSizeWithTextureType:(MTLTextureType)textureType
pixelFormat:(MTLPixelFormat)pixelFormat
sampleCount:(NSUInteger)sampleCount
@@ -104,7 +104,7 @@
}
// MTLRenderCommandEncoder : based on the protocol defined in
// Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h
// Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h
- (void)setRenderPipelineState:(id<MTLRenderPipelineState>)pipelineState
{
@@ -141,6 +141,52 @@
return [self.real setVertexBuffers:buffers offsets:offsets withRange:range];
}
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_14_0
- (void)setVertexBuffer:(nullable id<MTLBuffer>)buffer
offset:(NSUInteger)offset
attributeStride:(NSUInteger)stride
atIndex:(NSUInteger)index API_AVAILABLE(macos(14.0), ios(17.0))
{
METAL_NOT_HOOKED();
return [self.real setVertexBuffer:buffer offset:offset attributeStride:stride atIndex:index];
}
#endif
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_14_0
- (void)setVertexBuffers:(id<MTLBuffer> const __nullable[__nonnull])buffers
offsets:(NSUInteger const[__nonnull])offsets
attributeStrides:(NSUInteger const[__nonnull])strides
withRange:(NSRange)range API_AVAILABLE(macos(14.0), ios(17.0))
{
METAL_NOT_HOOKED();
return [self.real setVertexBuffers:buffers
offsets:offsets
attributeStrides:strides
withRange:range];
}
#endif
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_14_0
- (void)setVertexBufferOffset:(NSUInteger)offset
attributeStride:(NSUInteger)stride
atIndex:(NSUInteger)index API_AVAILABLE(macos(14.0), ios(17.0))
{
METAL_NOT_HOOKED();
return [self.real setVertexBufferOffset:offset attributeStride:stride atIndex:index];
}
#endif
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_14_0
- (void)setVertexBytes:(void const *)bytes
length:(NSUInteger)length
attributeStride:(NSUInteger)stride
atIndex:(NSUInteger)index API_AVAILABLE(macos(14.0), ios(17.0))
{
METAL_NOT_HOOKED();
return [self.real setVertexBytes:bytes length:length attributeStride:stride atIndex:index];
}
#endif
- (void)setVertexTexture:(nullable id<MTLTexture>)texture atIndex:(NSUInteger)index
{
METAL_NOT_HOOKED();
@@ -67,3 +67,7 @@ inline WrappedMTLResource *GetWrapped(id<MTLResource> objC)
#ifndef __MAC_13_3
#define __MAC_13_3 130300
#endif
#ifndef __MAC_14_0
#define __MAC_14_0 140000
#endif