diff --git a/include/Metal/MTLCommandBuffer.h b/include/Metal/MTLCommandBuffer.h index 71464ee..b981bd5 100644 --- a/include/Metal/MTLCommandBuffer.h +++ b/include/Metal/MTLCommandBuffer.h @@ -47,6 +47,7 @@ typedef void (^MTLCommandBufferHandler)(id); @property(readonly) id commandQueue; @property (readonly) id device; +@property(nullable, copy, atomic) NSString* label; - (id)computeCommandEncoderWithDescriptor: (MTLComputePassDescriptor*)computePassDescriptor; - (id)computeCommandEncoderWithDispatchType: (MTLDispatchType)dispatchType; diff --git a/include/Metal/MTLCommandEncoder.h b/include/Metal/MTLCommandEncoder.h index 6fd4b7b..1996870 100644 --- a/include/Metal/MTLCommandEncoder.h +++ b/include/Metal/MTLCommandEncoder.h @@ -28,6 +28,7 @@ METAL_DECLARATIONS_BEGIN @protocol MTLCommandEncoder @property(readonly) id device; +@property(nullable, copy, atomic) NSString* label; - (void)endEncoding; diff --git a/include/Metal/MTLCommandQueue.h b/include/Metal/MTLCommandQueue.h index 0048049..39ea36d 100644 --- a/include/Metal/MTLCommandQueue.h +++ b/include/Metal/MTLCommandQueue.h @@ -33,6 +33,7 @@ METAL_DECLARATIONS_BEGIN @protocol MTLCommandQueue @property(readonly) id device; +@property(nullable, copy, atomic) NSString* label; - (id)commandBuffer; diff --git a/include/Metal/MTLComputePipeline.h b/include/Metal/MTLComputePipeline.h index 4095632..1c99233 100644 --- a/include/Metal/MTLComputePipeline.h +++ b/include/Metal/MTLComputePipeline.h @@ -57,6 +57,7 @@ MTL_EXPORT @property(readwrite, nullable, copy, nonatomic) MTLLinkedFunctions* linkedFunctions; @property(readwrite, nonatomic) BOOL supportAddingBinaryFunctions; @property(readwrite, nullable, nonatomic, copy) NSArray>* binaryArchives; +@property(nullable, copy, atomic) NSString* label; - (void)reset; @@ -69,6 +70,7 @@ MTL_EXPORT @property(readonly) NSUInteger staticThreadgroupMemoryLength; @property(readonly) id device; @property(readonly) BOOL supportIndirectCommandBuffers; +@property(readonly) NSString* label; - (NSUInteger)imageblockMemoryLengthForDimensions: (MTLSize)imageblockDimensions; diff --git a/include/Metal/MTLLibrary.h b/include/Metal/MTLLibrary.h index efc7af9..f6a1e47 100644 --- a/include/Metal/MTLLibrary.h +++ b/include/Metal/MTLLibrary.h @@ -75,6 +75,7 @@ typedef NS_ENUM(NSUInteger, MTLLibraryType) { @property(readonly) NSArray* vertexAttributes; @property(readonly) NSArray* stageInputAttributes; @property(readonly) NSDictionary* functionConstantsDictionary; +@property(nullable, copy, nonatomic) NSString* label; - (id)newArgumentEncoderWithBufferIndex: (NSUInteger)bufferIndex; @@ -89,6 +90,7 @@ typedef NS_ENUM(NSUInteger, MTLLibraryType) { @property(readonly) MTLLibraryType type; @property(readonly) NSArray* functionNames; @property(readonly) id device; +@property(nullable, copy, nonatomic) NSString* label; - (id)newFunctionWithName: (NSString*)functionName; diff --git a/include/Metal/MTLRenderPipeline.h b/include/Metal/MTLRenderPipeline.h index 9379abb..37b7c5f 100644 --- a/include/Metal/MTLRenderPipeline.h +++ b/include/Metal/MTLRenderPipeline.h @@ -170,6 +170,7 @@ MTL_EXPORT @property(copy, nonatomic) MTLLinkedFunctions* fragmentLinkedFunctions; @property(readwrite, nonnull, nonatomic, copy) NSArray>* fragmentPreloadedLibraries; @property(readwrite, nonnull, nonatomic, copy) NSArray>* vertexPreloadedLibraries; +@property(nullable, copy, nonatomic) NSString* label; - (void)reset; @@ -178,6 +179,7 @@ MTL_EXPORT @protocol MTLRenderPipelineState @property(readonly) id device; +@property(readonly) NSString* label; @end diff --git a/include/Metal/MTLResource.h b/include/Metal/MTLResource.h index e82c4c4..e7155f4 100644 --- a/include/Metal/MTLResource.h +++ b/include/Metal/MTLResource.h @@ -71,6 +71,7 @@ typedef NS_OPTIONS(NSUInteger, MTLResourceOptions) { @property(readonly) MTLStorageMode storageMode; @property(readonly) MTLHazardTrackingMode hazardTrackingMode; @property(readonly) MTLResourceOptions resourceOptions; +@property(nullable, copy, nonatomic) NSString* label; @end diff --git a/private-include/Metal/MTLComputePipelineInternal.h b/private-include/Metal/MTLComputePipelineInternal.h index 7938c87..9d4cf62 100644 --- a/private-include/Metal/MTLComputePipelineInternal.h +++ b/private-include/Metal/MTLComputePipelineInternal.h @@ -35,7 +35,8 @@ @property(readonly) std::shared_ptr state; - (instancetype)initWithState: (std::shared_ptr)state - device: (id)device; + device: (id)device + label: (NSString*)label; @end diff --git a/private-include/Metal/MTLRenderPipelineInternal.h b/private-include/Metal/MTLRenderPipelineInternal.h index c79c863..76746b0 100644 --- a/private-include/Metal/MTLRenderPipelineInternal.h +++ b/private-include/Metal/MTLRenderPipelineInternal.h @@ -53,7 +53,8 @@ METAL_DECLARATIONS_BEGIN @property(readonly) std::shared_ptr state; - (instancetype)initWithState: (std::shared_ptr)state - device: (id)device; + device: (id)device + label: (NSString*)label; @end diff --git a/src/Metal/MTLBuffer.mm b/src/Metal/MTLBuffer.mm index 9f15d0d..e389801 100644 --- a/src/Metal/MTLBuffer.mm +++ b/src/Metal/MTLBuffer.mm @@ -29,6 +29,7 @@ @synthesize buffer = _buffer; @synthesize device = _device; @synthesize resourceOptions = _resourceOptions; +@synthesize label = _label; - (instancetype)initWithBuffer: (std::shared_ptr)buffer device: (id)device @@ -46,6 +47,7 @@ - (void)dealloc { [_device release]; + [_label release]; [super dealloc]; } diff --git a/src/Metal/MTLCommandBuffer.mm b/src/Metal/MTLCommandBuffer.mm index 4a064a1..e04533f 100644 --- a/src/Metal/MTLCommandBuffer.mm +++ b/src/Metal/MTLCommandBuffer.mm @@ -70,6 +70,7 @@ struct MTLCommandBufferHandlerWrapper { @synthesize device = _device; @synthesize commandQueue = _commandQueue; +@synthesize label = _label; - (instancetype)initWithCommandBuffer: (std::shared_ptr)commandBuffer commandQueue: (id)commandQueue @@ -87,6 +88,7 @@ struct MTLCommandBufferHandlerWrapper { { [_device release]; [_commandQueue release]; + [_label release]; [super dealloc]; } diff --git a/src/Metal/MTLCommandQueue.mm b/src/Metal/MTLCommandQueue.mm index 3025aa5..3eacb44 100644 --- a/src/Metal/MTLCommandQueue.mm +++ b/src/Metal/MTLCommandQueue.mm @@ -31,6 +31,7 @@ } @synthesize device = _device; +@synthesize label = _label; - (instancetype)initWithQueue: (std::shared_ptr)queue device: (id)device @@ -46,7 +47,7 @@ - (void)dealloc { [_device release]; - + [_label release]; [super dealloc]; } diff --git a/src/Metal/MTLComputeCommandEncoder.mm b/src/Metal/MTLComputeCommandEncoder.mm index c84a9db..9350239 100644 --- a/src/Metal/MTLComputeCommandEncoder.mm +++ b/src/Metal/MTLComputeCommandEncoder.mm @@ -185,6 +185,7 @@ MTL_UNSUPPORTED_CLASS } @synthesize device = _device; +@synthesize label = _label; - (instancetype)initWithEncoder: (std::shared_ptr)encoder device: (id)device @@ -200,6 +201,7 @@ MTL_UNSUPPORTED_CLASS - (void)dealloc { [_device release]; + [_label release]; [super dealloc]; } diff --git a/src/Metal/MTLComputePipeline.mm b/src/Metal/MTLComputePipeline.mm index d94962f..77f9b85 100644 --- a/src/Metal/MTLComputePipeline.mm +++ b/src/Metal/MTLComputePipeline.mm @@ -55,6 +55,7 @@ [_preloadedLibraries release]; [_linkedFunctions release]; [_binaryArchives release]; + [_label release]; [super dealloc]; } @@ -77,6 +78,7 @@ copy.linkedFunctions = self.linkedFunctions; copy.supportAddingBinaryFunctions = self.supportAddingBinaryFunctions; copy.binaryArchives = self.binaryArchives; + copy.label = self.label; return copy; } @@ -105,6 +107,7 @@ self.linkedFunctions = nil; self.supportAddingBinaryFunctions = NO; // TODO: check what the actual default is self.binaryArchives = nil; + self.label = nil; } #else @@ -146,14 +149,17 @@ MTL_UNSUPPORTED_CLASS @synthesize device = _device; @synthesize state = _pso; +@synthesize label = _label; - (instancetype)initWithState: (std::shared_ptr)state device: (id)device + label: (NSString*)label { self = [super init]; if (self != nil) { _pso = state; _device = [device retain]; + _label = [label copy]; } return self; } @@ -161,7 +167,7 @@ MTL_UNSUPPORTED_CLASS - (void)dealloc { [_device release]; - + [_label release]; [super dealloc]; } diff --git a/src/Metal/MTLDevice.mm b/src/Metal/MTLDevice.mm index 4a11611..0862d9a 100644 --- a/src/Metal/MTLDevice.mm +++ b/src/Metal/MTLDevice.mm @@ -180,7 +180,7 @@ void MTLRemoveDeviceObserver(id observer) { } return nil; } - return [[MTLComputePipelineStateInternal alloc] initWithState: pso device: self]; + return [[MTLComputePipelineStateInternal alloc] initWithState: pso device: self label: descriptor.label]; } - (id)newComputePipelineStateWithFunction: (id)computeFunction @@ -205,7 +205,7 @@ void MTLRemoveDeviceObserver(id observer) { } return nil; } - return [[MTLComputePipelineStateInternal alloc] initWithState: pso device: self]; + return [[MTLComputePipelineStateInternal alloc] initWithState: pso device: self label: nil]; } - (id)newRenderPipelineStateWithDescriptor: (MTLRenderPipelineDescriptor*)descriptor @@ -219,7 +219,7 @@ void MTLRemoveDeviceObserver(id observer) { } return nil; } - return [[MTLRenderPipelineStateInternal alloc] initWithState: pso device: self]; + return [[MTLRenderPipelineStateInternal alloc] initWithState: pso device: self label: descriptor.label]; } - (id)newCommandQueue diff --git a/src/Metal/MTLLibrary.mm b/src/Metal/MTLLibrary.mm index adc1216..53c0c1e 100644 --- a/src/Metal/MTLLibrary.mm +++ b/src/Metal/MTLLibrary.mm @@ -35,6 +35,7 @@ @synthesize vertexAttributes = _vertexAttributes; @synthesize stageInputAttributes = _stageInputAttributes; @synthesize functionConstantsDictionary = _functionConstantsDictionary; +@synthesize label = _label; - (instancetype)initWithFunction: (std::shared_ptr)function device: (id)device @@ -57,6 +58,7 @@ [_vertexAttributes release]; [_stageInputAttributes release]; [_functionConstantsDictionary release]; + [_label release]; [super dealloc]; } @@ -92,6 +94,7 @@ MTL_UNSUPPORTED_CLASS @synthesize type = _type; @synthesize functionNames = _functionNames; @synthesize device = _device; +@synthesize label = _label; - (instancetype)initWithLibrary: (std::shared_ptr)library device: (id)device @@ -117,7 +120,7 @@ MTL_UNSUPPORTED_CLASS [_installName release]; [_functionNames release]; [_device release]; - + [_label release]; [super dealloc]; } diff --git a/src/Metal/MTLRenderCommandEncoder.mm b/src/Metal/MTLRenderCommandEncoder.mm index 93d1c0d..ac75502 100644 --- a/src/Metal/MTLRenderCommandEncoder.mm +++ b/src/Metal/MTLRenderCommandEncoder.mm @@ -510,6 +510,7 @@ MTL_UNSUPPORTED_CLASS @synthesize device = _device; @synthesize encoder = _encoder; +@synthesize label = _label; - (instancetype)initWithEncoder: (std::shared_ptr)encoder device: (id)device @@ -525,6 +526,7 @@ MTL_UNSUPPORTED_CLASS - (void)dealloc { [_device release]; + [_label release]; [super dealloc]; } diff --git a/src/Metal/MTLRenderPipeline.mm b/src/Metal/MTLRenderPipeline.mm index 45ab3fe..497a22e 100644 --- a/src/Metal/MTLRenderPipeline.mm +++ b/src/Metal/MTLRenderPipeline.mm @@ -61,6 +61,7 @@ @synthesize fragmentLinkedFunctions = _fragmentLinkedFunctions; @synthesize fragmentPreloadedLibraries = _fragmentPreloadedLibraries; @synthesize vertexPreloadedLibraries = _vertexPreloadedLibraries; +@synthesize label = _label; - (void)_doInit { @@ -98,6 +99,7 @@ [_fragmentLinkedFunctions release]; [_fragmentPreloadedLibraries release]; [_vertexPreloadedLibraries release]; + [_label release]; } - (instancetype)init @@ -154,6 +156,7 @@ copy.fragmentLinkedFunctions = _fragmentLinkedFunctions; copy.fragmentPreloadedLibraries = _fragmentPreloadedLibraries; copy.vertexPreloadedLibraries = _vertexPreloadedLibraries; + copy.label = _label; return copy; } @@ -390,14 +393,17 @@ MTL_UNSUPPORTED_CLASS @synthesize state = _state; @synthesize device = _device; +@synthesize label = _label; - (instancetype)initWithState: (std::shared_ptr)state device: (id)device + label: (NSString*)label { self = [super init]; if (self != nil) { _state = state; _device = [device retain]; + _label = [label copy]; } return self; } @@ -405,6 +411,7 @@ MTL_UNSUPPORTED_CLASS - (void)dealloc { [_device release]; + [_label release]; [super dealloc]; } diff --git a/src/Metal/MTLTexture.mm b/src/Metal/MTLTexture.mm index 6800111..cd43841 100644 --- a/src/Metal/MTLTexture.mm +++ b/src/Metal/MTLTexture.mm @@ -30,6 +30,7 @@ @synthesize texture = _texture; @synthesize device = _device; @synthesize resourceOptions = _resourceOptions; +@synthesize label = _label; - (instancetype)initWithTexture: (std::shared_ptr)texture device: (id)device @@ -47,6 +48,7 @@ - (void)dealloc { [_device release]; + [_label release]; [super dealloc]; }