1 #ifndef MTLTexturePool_h_Included 2 #define MTLTexturePool_h_Included 3 #import <Metal/Metal.h> 4 5 @interface MTLTexturePoolItem : NSObject 6 { 7 @private 8 9 id<MTLTexture> texture; 10 bool isBusy; 11 } 12 13 @property (readwrite, retain) id<MTLTexture> texture; 14 @property (readwrite, assign) bool isBusy; 15 16 - (id) initWithTexture:(id<MTLTexture>)tex; 17 @end 18 19 // NOTE: owns all MTLTexture objects 20 @interface MTLTexturePool : NSObject 21 { 22 @private 23 24 id<MTLDevice> device; 25 NSMutableArray<MTLTexturePoolItem*> * pool; 26 } 27 28 @property (readwrite, assign) id<MTLDevice> device; 29 @property (readwrite, retain) NSMutableArray<MTLTexturePoolItem*> * pool; 30 31 - (id) initWithDevice:(id<MTLDevice>)device; 32 - (id<MTLTexture>) getTexture:(int)width height:(int)height format:(MTLPixelFormat)format; 33 - (void) markTextureFree:(id<MTLTexture>)texture; 34 - (void) markAllTexturesFree; 35 @end 36 37 #endif /* MTLTexturePool_h_Included */