1 #import <MetalPerformanceShaders/MetalPerformanceShaders.h> 2 3 @protocol PTMetalCommandBuffer<NSObject> 4 @optional 5 - (void)beginSynchronization; 6 - (void)endSynchronization:(NSError*)error; 7 @end 8 9 @interface MetalCommandBuffer : NSObject 10 @property(nonatomic, strong, readonly) id<MTLCommandBuffer> buffer; 11 @property(nonatomic, assign, readonly) BOOL valid; 12 13 + (MetalCommandBuffer*)newBuffer; 14 + (MetalCommandBuffer*)currentBuffer; 15 - (void)addSubscriber:(id<PTMetalCommandBuffer>)subscriber; 16 - (void)removeSubscriber:(id<PTMetalCommandBuffer>)subscriber; 17 - (void)commit; 18 - (void)add:(MPSTemporaryImage*)image; 19 - (void)remove:(MPSTemporaryImage*)image; 20 21 @end 22