5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_COMPUTE_PASS_BINDINGS_CACHE_MTL_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_COMPUTE_PASS_BINDINGS_CACHE_MTL_H_
8 #include <Metal/Metal.h>
35 void SetEncoder(id<MTLComputeCommandEncoder> encoder);
37 void SetBuffer(uint64_t index, uint64_t offset, id<MTLBuffer> buffer);
39 void SetTexture(uint64_t index, id<MTLTexture> texture);
41 void SetSampler(uint64_t index, id<MTLSamplerState> sampler);
44 struct BufferOffsetPair {
45 id<MTLBuffer> buffer =
nullptr;
48 using BufferMap = std::map<uint64_t, BufferOffsetPair>;
49 using TextureMap = std::map<uint64_t, id<MTLTexture>>;
50 using SamplerMap = std::map<uint64_t, id<MTLSamplerState>>;
52 id<MTLComputeCommandEncoder> encoder_;
53 id<MTLComputePipelineState> pipeline_ =
nullptr;
Ensures that bindings on the pass are not redundantly set or updated. Avoids making the driver do add...
void SetEncoder(id< MTLComputeCommandEncoder > encoder)
void SetComputePipelineState(id< MTLComputePipelineState > pipeline)
void SetBuffer(uint64_t index, uint64_t offset, id< MTLBuffer > buffer)
ComputePassBindingsCacheMTL(ComputePassBindingsCacheMTL &&)=delete
ComputePassBindingsCacheMTL()
void SetSampler(uint64_t index, id< MTLSamplerState > sampler)
ComputePassBindingsCacheMTL(const ComputePassBindingsCacheMTL &)=delete
id< MTLComputePipelineState > GetPipeline() const
void SetTexture(uint64_t index, id< MTLTexture > texture)