1 #ifndef MTLPipelineStatesStorage_h_Included 2 #define MTLPipelineStatesStorage_h_Included 3 4 #import <Metal/Metal.h> 5 6 @interface MTLPipelineStatesStorage : NSObject { 7 @private 8 9 id<MTLDevice> device; 10 id<MTLLibrary> library; 11 NSMutableDictionary<NSString*, id<MTLFunction>> * shaders; 12 NSMutableDictionary<NSString*, id<MTLRenderPipelineState>> * states; 13 MTLRenderPipelineDescriptor * templateRenderPipelineDesc; 14 MTLRenderPipelineDescriptor * templateTexturePipelineDesc; 15 } 16 17 @property (readwrite, assign) id<MTLDevice> device; 18 @property (readwrite, retain) id<MTLLibrary> library; 19 @property (readwrite, retain) NSMutableDictionary<NSString*, id<MTLFunction>> * shaders; 20 @property (readwrite, retain) NSMutableDictionary<NSString*, id<MTLRenderPipelineState>> * states; 21 @property (readwrite, retain) MTLRenderPipelineDescriptor * templateRenderPipelineDesc; 22 @property (readwrite, retain) MTLRenderPipelineDescriptor * templateTexturePipelineDesc; 23 24 - (id) initWithDevice:(id<MTLDevice>)device shaderLibPath:(NSString *)shadersLib; 25 - (id<MTLRenderPipelineState>) getRenderPipelineState:(bool)isGradient; 26 - (id<MTLRenderPipelineState>) getTexturePipelineState:(bool)isSourcePremultiplied compositeRule:(int)compositeRule; 27 - (id<MTLFunction>) getShader:(NSString *)name; 28 @end 29 30 31 #endif // MTLPipelineStatesStorage_h_Included