Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
impeller::ComputePassBindingsCacheMTL Struct Reference

Ensures that bindings on the pass are not redundantly set or updated. Avoids making the driver do additional checks and makes the frame insights during profiling and instrumentation not complain about the same. More...

#include <compute_pass_bindings_cache_mtl.h>

Public Member Functions

 ComputePassBindingsCacheMTL ()
 
 ComputePassBindingsCacheMTL (const ComputePassBindingsCacheMTL &)=delete
 
 ComputePassBindingsCacheMTL (ComputePassBindingsCacheMTL &&)=delete
 
void SetComputePipelineState (id< MTLComputePipelineState > pipeline)
 
id< MTLComputePipelineState > GetPipeline () const
 
void SetEncoder (id< MTLComputeCommandEncoder > encoder)
 
void SetBuffer (uint64_t index, uint64_t offset, id< MTLBuffer > buffer)
 
void SetTexture (uint64_t index, id< MTLTexture > texture)
 
void SetSampler (uint64_t index, id< MTLSamplerState > sampler)
 

Detailed Description

Ensures that bindings on the pass are not redundantly set or updated. Avoids making the driver do additional checks and makes the frame insights during profiling and instrumentation not complain about the same.

There should be no change to rendering if this caching was absent.

Definition at line 24 of file compute_pass_bindings_cache_mtl.h.

Constructor & Destructor Documentation

◆ ComputePassBindingsCacheMTL() [1/3]

impeller::ComputePassBindingsCacheMTL::ComputePassBindingsCacheMTL ( )
inlineexplicit

Definition at line 25 of file compute_pass_bindings_cache_mtl.h.

25{}

◆ ComputePassBindingsCacheMTL() [2/3]

impeller::ComputePassBindingsCacheMTL::ComputePassBindingsCacheMTL ( const ComputePassBindingsCacheMTL )
delete

◆ ComputePassBindingsCacheMTL() [3/3]

impeller::ComputePassBindingsCacheMTL::ComputePassBindingsCacheMTL ( ComputePassBindingsCacheMTL &&  )
delete

Member Function Documentation

◆ GetPipeline()

id< MTLComputePipelineState > impeller::ComputePassBindingsCacheMTL::GetPipeline ( ) const

Definition at line 18 of file compute_pass_bindings_cache_mtl.mm.

18 {
19 return pipeline_;
20}

◆ SetBuffer()

void impeller::ComputePassBindingsCacheMTL::SetBuffer ( uint64_t  index,
uint64_t  offset,
id< MTLBuffer >  buffer 
)

Definition at line 27 of file compute_pass_bindings_cache_mtl.mm.

29 {
30 auto found = buffers_.find(index);
31 if (found != buffers_.end() && found->second.buffer == buffer) {
32 // The right buffer is bound. Check if its offset needs to be updated.
33 if (found->second.offset == offset) {
34 // Buffer and its offset is identical. Nothing to do.
35 return;
36 }
37
38 // Only the offset needs to be updated.
39 found->second.offset = offset;
40
41 [encoder_ setBufferOffset:offset atIndex:index];
42 return;
43 }
44
45 buffers_[index] = {buffer, static_cast<size_t>(offset)};
46 [encoder_ setBuffer:buffer offset:offset atIndex:index];
47}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
SeparatedVector2 offset

◆ SetComputePipelineState()

void impeller::ComputePassBindingsCacheMTL::SetComputePipelineState ( id< MTLComputePipelineState >  pipeline)

Definition at line 9 of file compute_pass_bindings_cache_mtl.mm.

10 {
11 if (pipeline == pipeline_) {
12 return;
13 }
14 pipeline_ = pipeline;
15 [encoder_ setComputePipelineState:pipeline_];
16}

◆ SetEncoder()

void impeller::ComputePassBindingsCacheMTL::SetEncoder ( id< MTLComputeCommandEncoder >  encoder)

Definition at line 22 of file compute_pass_bindings_cache_mtl.mm.

23 {
24 encoder_ = encoder;
25}

◆ SetSampler()

void impeller::ComputePassBindingsCacheMTL::SetSampler ( uint64_t  index,
id< MTLSamplerState >  sampler 
)

Definition at line 61 of file compute_pass_bindings_cache_mtl.mm.

62 {
63 auto found = samplers_.find(index);
64 if (found != samplers_.end() && found->second == sampler) {
65 // Already bound.
66 return;
67 }
68 samplers_[index] = sampler;
69 [encoder_ setSamplerState:sampler atIndex:index];
70 return;
71}

◆ SetTexture()

void impeller::ComputePassBindingsCacheMTL::SetTexture ( uint64_t  index,
id< MTLTexture >  texture 
)

Definition at line 49 of file compute_pass_bindings_cache_mtl.mm.

50 {
51 auto found = textures_.find(index);
52 if (found != textures_.end() && found->second == texture) {
53 // Already bound.
54 return;
55 }
56 textures_[index] = texture;
57 [encoder_ setTexture:texture atIndex:index];
58 return;
59}
FlTexture * texture

The documentation for this struct was generated from the following files: