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.

48 lines
1.4 KiB

  1. //
  2. // SCMetalModule.h
  3. // Snapchat
  4. //
  5. // Created by Michel Loenngren on 7/19/17.
  6. //
  7. //
  8. #import "SCMetalTextureResource.h"
  9. #import "SCMetalUtils.h"
  10. #import "SCProcessingModule.h"
  11. #import <Foundation/Foundation.h>
  12. @protocol SCMetalModuleFunctionProvider <NSObject>
  13. @property (nonatomic, readonly) NSString *functionName;
  14. @end
  15. @protocol SCMetalRenderCommand <SCMetalModuleFunctionProvider>
  16. /**
  17. Sets textures and parameters for the shader function. When implementing this function, the command encoder must be
  18. computed and the pipeline state set. That is, ensure that there are calls to: [commandBuffer computeCommandEncoder]
  19. and [commandEncoder setComputePipelineState:pipelineState].
  20. */
  21. #if !TARGET_IPHONE_SIMULATOR
  22. - (id<MTLComputeCommandEncoder>)encodeMetalCommand:(id<MTLCommandBuffer>)commandBuffer
  23. pipelineState:(id<MTLComputePipelineState>)pipelineState
  24. textureResource:(SCMetalTextureResource *)textureResource;
  25. #endif
  26. - (BOOL)requiresDepthData;
  27. @end
  28. /**
  29. NOTE: If we start chaining multiple metal modules we should
  30. not run them back to back but instead chain different render
  31. passes.
  32. */
  33. @interface SCMetalModule : NSObject <SCProcessingModule>
  34. // Designated initializer: SCMetalModule should always have a SCMetalRenderCommand
  35. - (instancetype)initWithMetalRenderCommand:(id<SCMetalRenderCommand>)metalRenderCommand;
  36. @end