Add label properties everywhere they're required

This commit is contained in:
Ariel Abreu 2022-12-29 22:04:23 -05:00
parent ea0271e201
commit fe4017217f
No known key found for this signature in database
GPG Key ID: E84B94FA5458B151
19 changed files with 47 additions and 8 deletions

View File

@ -47,6 +47,7 @@ typedef void (^MTLCommandBufferHandler)(id<MTLCommandBuffer>);
@property(readonly) id<MTLCommandQueue> commandQueue;
@property (readonly) id<MTLDevice> device;
@property(nullable, copy, atomic) NSString* label;
- (id<MTLComputeCommandEncoder>)computeCommandEncoderWithDescriptor: (MTLComputePassDescriptor*)computePassDescriptor;
- (id<MTLComputeCommandEncoder>)computeCommandEncoderWithDispatchType: (MTLDispatchType)dispatchType;

View File

@ -28,6 +28,7 @@ METAL_DECLARATIONS_BEGIN
@protocol MTLCommandEncoder <NSObject>
@property(readonly) id<MTLDevice> device;
@property(nullable, copy, atomic) NSString* label;
- (void)endEncoding;

View File

@ -33,6 +33,7 @@ METAL_DECLARATIONS_BEGIN
@protocol MTLCommandQueue <NSObject>
@property(readonly) id<MTLDevice> device;
@property(nullable, copy, atomic) NSString* label;
- (id<MTLCommandBuffer>)commandBuffer;

View File

@ -57,6 +57,7 @@ MTL_EXPORT
@property(readwrite, nullable, copy, nonatomic) MTLLinkedFunctions* linkedFunctions;
@property(readwrite, nonatomic) BOOL supportAddingBinaryFunctions;
@property(readwrite, nullable, nonatomic, copy) NSArray<id<MTLBinaryArchive>>* binaryArchives;
@property(nullable, copy, atomic) NSString* label;
- (void)reset;
@ -69,6 +70,7 @@ MTL_EXPORT
@property(readonly) NSUInteger staticThreadgroupMemoryLength;
@property(readonly) id<MTLDevice> device;
@property(readonly) BOOL supportIndirectCommandBuffers;
@property(readonly) NSString* label;
- (NSUInteger)imageblockMemoryLengthForDimensions: (MTLSize)imageblockDimensions;

View File

@ -75,6 +75,7 @@ typedef NS_ENUM(NSUInteger, MTLLibraryType) {
@property(readonly) NSArray<MTLVertexAttribute*>* vertexAttributes;
@property(readonly) NSArray<MTLAttribute*>* stageInputAttributes;
@property(readonly) NSDictionary<NSString*, MTLFunctionConstant*>* functionConstantsDictionary;
@property(nullable, copy, nonatomic) NSString* label;
- (id<MTLArgumentEncoder>)newArgumentEncoderWithBufferIndex: (NSUInteger)bufferIndex;
@ -89,6 +90,7 @@ typedef NS_ENUM(NSUInteger, MTLLibraryType) {
@property(readonly) MTLLibraryType type;
@property(readonly) NSArray<NSString*>* functionNames;
@property(readonly) id<MTLDevice> device;
@property(nullable, copy, nonatomic) NSString* label;
- (id<MTLFunction>)newFunctionWithName: (NSString*)functionName;

View File

@ -170,6 +170,7 @@ MTL_EXPORT
@property(copy, nonatomic) MTLLinkedFunctions* fragmentLinkedFunctions;
@property(readwrite, nonnull, nonatomic, copy) NSArray<id<MTLDynamicLibrary>>* fragmentPreloadedLibraries;
@property(readwrite, nonnull, nonatomic, copy) NSArray<id<MTLDynamicLibrary>>* vertexPreloadedLibraries;
@property(nullable, copy, nonatomic) NSString* label;
- (void)reset;
@ -178,6 +179,7 @@ MTL_EXPORT
@protocol MTLRenderPipelineState <NSObject>
@property(readonly) id<MTLDevice> device;
@property(readonly) NSString* label;
@end

View File

@ -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

View File

@ -35,7 +35,8 @@
@property(readonly) std::shared_ptr<Indium::ComputePipelineState> state;
- (instancetype)initWithState: (std::shared_ptr<Indium::ComputePipelineState>)state
device: (id<MTLDevice>)device;
device: (id<MTLDevice>)device
label: (NSString*)label;
@end

View File

@ -53,7 +53,8 @@ METAL_DECLARATIONS_BEGIN
@property(readonly) std::shared_ptr<Indium::RenderPipelineState> state;
- (instancetype)initWithState: (std::shared_ptr<Indium::RenderPipelineState>)state
device: (id<MTLDevice>)device;
device: (id<MTLDevice>)device
label: (NSString*)label;
@end

View File

@ -29,6 +29,7 @@
@synthesize buffer = _buffer;
@synthesize device = _device;
@synthesize resourceOptions = _resourceOptions;
@synthesize label = _label;
- (instancetype)initWithBuffer: (std::shared_ptr<Indium::Buffer>)buffer
device: (id<MTLDevice>)device
@ -46,6 +47,7 @@
- (void)dealloc
{
[_device release];
[_label release];
[super dealloc];
}

View File

@ -70,6 +70,7 @@ struct MTLCommandBufferHandlerWrapper {
@synthesize device = _device;
@synthesize commandQueue = _commandQueue;
@synthesize label = _label;
- (instancetype)initWithCommandBuffer: (std::shared_ptr<Indium::CommandBuffer>)commandBuffer
commandQueue: (id<MTLCommandQueue>)commandQueue
@ -87,6 +88,7 @@ struct MTLCommandBufferHandlerWrapper {
{
[_device release];
[_commandQueue release];
[_label release];
[super dealloc];
}

View File

@ -31,6 +31,7 @@
}
@synthesize device = _device;
@synthesize label = _label;
- (instancetype)initWithQueue: (std::shared_ptr<Indium::CommandQueue>)queue
device: (id<MTLDevice>)device
@ -46,7 +47,7 @@
- (void)dealloc
{
[_device release];
[_label release];
[super dealloc];
}

View File

@ -185,6 +185,7 @@ MTL_UNSUPPORTED_CLASS
}
@synthesize device = _device;
@synthesize label = _label;
- (instancetype)initWithEncoder: (std::shared_ptr<Indium::ComputeCommandEncoder>)encoder
device: (id<MTLDevice>)device
@ -200,6 +201,7 @@ MTL_UNSUPPORTED_CLASS
- (void)dealloc
{
[_device release];
[_label release];
[super dealloc];
}

View File

@ -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<Indium::ComputePipelineState>)state
device: (id<MTLDevice>)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];
}

View File

@ -180,7 +180,7 @@ void MTLRemoveDeviceObserver(id<NSObject> observer) {
}
return nil;
}
return [[MTLComputePipelineStateInternal alloc] initWithState: pso device: self];
return [[MTLComputePipelineStateInternal alloc] initWithState: pso device: self label: descriptor.label];
}
- (id<MTLComputePipelineState>)newComputePipelineStateWithFunction: (id<MTLFunction>)computeFunction
@ -205,7 +205,7 @@ void MTLRemoveDeviceObserver(id<NSObject> observer) {
}
return nil;
}
return [[MTLComputePipelineStateInternal alloc] initWithState: pso device: self];
return [[MTLComputePipelineStateInternal alloc] initWithState: pso device: self label: nil];
}
- (id<MTLRenderPipelineState>)newRenderPipelineStateWithDescriptor: (MTLRenderPipelineDescriptor*)descriptor
@ -219,7 +219,7 @@ void MTLRemoveDeviceObserver(id<NSObject> observer) {
}
return nil;
}
return [[MTLRenderPipelineStateInternal alloc] initWithState: pso device: self];
return [[MTLRenderPipelineStateInternal alloc] initWithState: pso device: self label: descriptor.label];
}
- (id<MTLCommandQueue>)newCommandQueue

View File

@ -35,6 +35,7 @@
@synthesize vertexAttributes = _vertexAttributes;
@synthesize stageInputAttributes = _stageInputAttributes;
@synthesize functionConstantsDictionary = _functionConstantsDictionary;
@synthesize label = _label;
- (instancetype)initWithFunction: (std::shared_ptr<Indium::Function>)function
device: (id<MTLDevice>)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<Indium::Library>)library
device: (id<MTLDevice>)device
@ -117,7 +120,7 @@ MTL_UNSUPPORTED_CLASS
[_installName release];
[_functionNames release];
[_device release];
[_label release];
[super dealloc];
}

View File

@ -510,6 +510,7 @@ MTL_UNSUPPORTED_CLASS
@synthesize device = _device;
@synthesize encoder = _encoder;
@synthesize label = _label;
- (instancetype)initWithEncoder: (std::shared_ptr<Indium::RenderCommandEncoder>)encoder
device: (id<MTLDevice>)device
@ -525,6 +526,7 @@ MTL_UNSUPPORTED_CLASS
- (void)dealloc
{
[_device release];
[_label release];
[super dealloc];
}

View File

@ -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<Indium::RenderPipelineState>)state
device: (id<MTLDevice>)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];
}

View File

@ -30,6 +30,7 @@
@synthesize texture = _texture;
@synthesize device = _device;
@synthesize resourceOptions = _resourceOptions;
@synthesize label = _label;
- (instancetype)initWithTexture: (std::shared_ptr<Indium::Texture>)texture
device: (id<MTLDevice>)device
@ -47,6 +48,7 @@
- (void)dealloc
{
[_device release];
[_label release];
[super dealloc];
}