Last active
August 7, 2018 11:20
-
-
Save noppefoxwolf/8540f2a18a8a8268422947cbbddb1f93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if TARGET_OS_SIMULATOR | |
#import <Metal/Metal.h> | |
#import <CoreVideo/CoreVideo.h> | |
/// CAMetalLayer | |
@class CAMetalLayer; | |
@protocol CAMetalDrawable <MTLDrawable> | |
@property(readonly) id <MTLTexture> texture; | |
@property(readonly) CAMetalLayer *layer; | |
@end | |
@interface CAMetalLayer : CALayer | |
@property(nullable, retain) id <MTLDevice> device; | |
@property MTLPixelFormat pixelFormat; | |
@property BOOL framebufferOnly; | |
@property CGSize drawableSize; | |
@property NSUInteger maximumDrawableCount; | |
@property BOOL presentsWithTransaction; | |
@property BOOL allowsNextDrawableTimeout; | |
- (nullable id <CAMetalDrawable>)nextDrawable; | |
@end | |
/// CVImageBuffer | |
@protocol MTLTexture; | |
typedef CVImageBufferRef CVMetalTextureRef; | |
CV_EXPORT CFTypeID CVMetalTextureGetTypeID(void); | |
CV_EXPORT id <MTLTexture> CV_NULLABLE CVMetalTextureGetTexture( CVMetalTextureRef CV_NONNULL image ); | |
CV_EXPORT Boolean CVMetalTextureIsFlipped( CVMetalTextureRef CV_NONNULL image ); | |
CV_EXPORT void CVMetalTextureGetCleanTexCoords( CVMetalTextureRef CV_NONNULL image, | |
float lowerLeft[2], | |
float lowerRight[2], | |
float upperRight[2], | |
float upperLeft[2] ); | |
CV_EXPORT const CFStringRef CV_NONNULL kCVMetalTextureUsage; | |
/// CVMetalTextureCache | |
CV_EXPORT const CFStringRef CV_NONNULL kCVMetalTextureCacheMaximumTextureAgeKey; | |
@protocol MTLDevice; | |
typedef struct CV_BRIDGED_TYPE(id) __CVMetalTextureCache *CVMetalTextureCacheRef; | |
CV_EXPORT CFTypeID CVMetalTextureCacheGetTypeID(void); | |
CV_EXPORT CVReturn CVMetalTextureCacheCreate(CFAllocatorRef CV_NULLABLE allocator, | |
CFDictionaryRef CV_NULLABLE cacheAttributes, | |
id <MTLDevice> CV_NONNULL metalDevice, | |
CFDictionaryRef CV_NULLABLE textureAttributes, | |
CV_RETURNS_RETAINED_PARAMETER CVMetalTextureCacheRef CV_NULLABLE * CV_NONNULL cacheOut ); | |
CV_EXPORT CVReturn CVMetalTextureCacheCreateTextureFromImage( | |
CFAllocatorRef CV_NULLABLE allocator, | |
CVMetalTextureCacheRef CV_NONNULL textureCache, | |
CVImageBufferRef CV_NONNULL sourceImage, | |
CFDictionaryRef CV_NULLABLE textureAttributes, | |
MTLPixelFormat pixelFormat, | |
size_t width, | |
size_t height, | |
size_t planeIndex, | |
CV_RETURNS_RETAINED_PARAMETER CVMetalTextureRef CV_NULLABLE * CV_NONNULL textureOut ); | |
CV_EXPORT void CVMetalTextureCacheFlush(CVMetalTextureCacheRef CV_NONNULL textureCache, CVOptionFlags options); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment