2014 snapchat source code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.1 KiB

  1. //
  2. // SCMetalTextureResource.h
  3. // Snapchat
  4. //
  5. // Created by Brian Ng on 11/7/17.
  6. //
  7. #import "SCProcessingModule.h"
  8. #import "SCCapturerDefines.h"
  9. #import <Foundation/Foundation.h>
  10. #if !TARGET_IPHONE_SIMULATOR
  11. #import <Metal/Metal.h>
  12. #endif
  13. /*
  14. @class SCMetalTextureResource
  15. The SCMetalTextureResource is created by SCMetalModule and is passed to a SCMetalRenderCommand.
  16. This resource provides a collection of textures for rendering, where a SCMetalRenderCommand
  17. selects which textures it needs. Textures are lazily initialiazed to optimize performance.
  18. Additionally, information pertaining to depth is provided if normalizing depth is desired:
  19. depthRange is the range of possible depth values [depthOffset, depthOffset + depthRange],
  20. where depthOffset is the min depth value in the given depth map.
  21. NOTE: This class is NOT thread safe -- ensure any calls are made by a performer by calling
  22. SCAssertPerformer before actually accessing any textures
  23. */
  24. @interface SCMetalTextureResource : NSObject
  25. #if !TARGET_IPHONE_SIMULATOR
  26. @property (nonatomic, readonly) id<MTLTexture> sourceYTexture;
  27. @property (nonatomic, readonly) id<MTLTexture> sourceUVTexture;
  28. @property (nonatomic, readonly) id<MTLTexture> destinationYTexture;
  29. @property (nonatomic, readonly) id<MTLTexture> destinationUVTexture;
  30. // Textures for SCDepthBlurMetalCommand
  31. @property (nonatomic, readonly) id<MTLTexture> sourceBlurredYTexture;
  32. @property (nonatomic, readonly) id<MTLTexture> sourceDepthTexture;
  33. @property (nonatomic, readonly) id<MTLDevice> device;
  34. #endif
  35. // Available depth-related auxiliary resources (when depth data is provided)
  36. @property (nonatomic, readonly) float depthRange;
  37. @property (nonatomic, readonly) float depthOffset;
  38. @property (nonatomic, readonly) CGFloat depthBlurForegroundThreshold;
  39. @property (nonatomic, readonly) SampleBufferMetadata sampleBufferMetadata;
  40. #if !TARGET_IPHONE_SIMULATOR
  41. - (instancetype)initWithRenderData:(RenderData)renderData
  42. textureCache:(CVMetalTextureCacheRef)textureCache
  43. device:(id<MTLDevice>)device;
  44. #endif
  45. @end