|
| 1 | +// |
| 2 | +// ORBDevice.h |
| 3 | +// OpenRenderBox |
| 4 | + |
| 5 | +#pragma once |
| 6 | + |
| 7 | +#include <OpenRenderBox/ORBBase.h> |
| 8 | + |
| 9 | +#if ORB_OBJC_FOUNDATION |
| 10 | + |
| 11 | +#include <Foundation/Foundation.h> |
| 12 | +#include <Metal/Metal.h> |
| 13 | +#include <OpenRenderBoxObjC/Render/ORBImageRenderer.h> |
| 14 | +#include <dispatch/dispatch.h> |
| 15 | + |
| 16 | +@protocol MTLCaptureScope, MTLDevice, OS_dispatch_queue; |
| 17 | + |
| 18 | +ORB_ASSUME_NONNULL_BEGIN |
| 19 | + |
| 20 | +@interface ORBDevice: NSObject <ORBImageRenderer> |
| 21 | + |
| 22 | +@property (readonly, nonatomic) id<MTLDevice> device; |
| 23 | +@property (readonly, nonatomic) NSObject<OS_dispatch_queue> *queue; |
| 24 | +@property (readonly, nonatomic, nullable) id<MTLCaptureScope> captureScope; |
| 25 | +@property NSUInteger GPUPriority; |
| 26 | +@property NSUInteger backgroundGPUPriority; |
| 27 | + |
| 28 | +/* class methods */ |
| 29 | ++ (nullable instancetype)sharedDefaultDevice; |
| 30 | ++ (NSArray<ORBDevice *> *)allDevices; |
| 31 | ++ (BOOL)isSupported; |
| 32 | ++ (void)setAllowsRenderingInBackground:(BOOL)background; |
| 33 | ++ (BOOL)allowsRenderingInBackground; |
| 34 | ++ (NSUInteger)defaultBackgroundGPUPriority; |
| 35 | ++ (NSUInteger)defaultGPUPriority; |
| 36 | ++ (BOOL)isRunningInBackground; |
| 37 | ++ (void)setDefaultBackgroundGPUPriority:(NSUInteger)gpupriority; |
| 38 | ++ (void)setDefaultGPUPriority:(NSUInteger)gpupriority; |
| 39 | ++ (nullable instancetype)sharedDevice:(id<MTLDevice>)device; |
| 40 | ++ (nullable instancetype)sharedDeviceForDisplay:(unsigned int)display; |
| 41 | + |
| 42 | +/* instance methods */ |
| 43 | +- (void)dealloc; |
| 44 | +- (instancetype)initWithDevice:(id<MTLDevice>)device; |
| 45 | +- (nullable CGImageRef)renderImageInRect:(CGRect)rect options:(nullable id)options renderer:(nullable id /* block */)renderer; |
| 46 | +- (void)collectResources; |
| 47 | +- (void)compileShader:(id)shader completionQueue:(nullable id)queue handler:(nullable id /* block */)handler; |
| 48 | +- (BOOL)compileShader:(id)shader error:(id _Nullable * _Nullable)error; |
| 49 | +- (nullable id)pipelineDescriptions:(nullable id)descriptions extraColorFormats:(nullable id)formats; |
| 50 | +- (void)renderImageInRect:(CGRect)rect options:(nullable id)options renderer:(nullable id /* block */)renderer completionQueue:(nullable id)queue handler:(nullable id /* block */)handler; |
| 51 | + |
| 52 | +@end |
| 53 | + |
| 54 | +ORB_ASSUME_NONNULL_END |
| 55 | + |
| 56 | +#endif /* ORB_OBJC_FOUNDATION */ |
0 commit comments