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 <pass_bindings_cache_mtl.h>
Public Member Functions | |
PassBindingsCacheMTL () | |
~PassBindingsCacheMTL ()=default | |
PassBindingsCacheMTL (const PassBindingsCacheMTL &)=delete | |
PassBindingsCacheMTL (PassBindingsCacheMTL &&)=delete | |
void | SetEncoder (id< MTLRenderCommandEncoder > encoder) |
Set the command encoder for this pass bindings cache. More... | |
void | SetRenderPipelineState (id< MTLRenderPipelineState > pipeline) |
Set the render pipeline state for the current encoder. More... | |
void | SetDepthStencilState (id< MTLDepthStencilState > depth_stencil) |
Set the depth and stencil state for the current encoder. More... | |
bool | SetBuffer (ShaderStage stage, uint64_t index, uint64_t offset, id< MTLBuffer > buffer) |
Set the buffer for the given shader stage, binding, and offset. More... | |
bool | SetTexture (ShaderStage stage, uint64_t index, id< MTLTexture > texture) |
Set the texture for the given stage and binding. More... | |
bool | SetSampler (ShaderStage stage, uint64_t index, id< MTLSamplerState > sampler) |
Set the sampler for the given stage and binding. More... | |
void | SetViewport (const Viewport &viewport) |
Set the viewport if the value is different from the current encoder state. More... | |
void | SetScissor (const IRect &scissor) |
Set the encoder scissor rect if the value is different from the current encoder state. More... | |
void | SetStencilRef (uint32_t stencil_ref) |
Set the encoder's stencil reference if the value is different from the current encoder state. More... | |
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 pass_bindings_cache_mtl.h.
|
inlineexplicit |
Definition at line 25 of file pass_bindings_cache_mtl.h.
|
default |
|
delete |
|
delete |
bool impeller::PassBindingsCacheMTL::SetBuffer | ( | ShaderStage | stage, |
uint64_t | index, | ||
uint64_t | offset, | ||
id< MTLBuffer > | buffer | ||
) |
Set the buffer for the given shader stage, binding, and offset.
If the buffer is already bound, only the offset is updated.
Definition at line 31 of file pass_bindings_cache_mtl.mm.
References impeller::kFragment, impeller::kVertex, and VALIDATION_LOG.
Referenced by impeller::Bind().
void impeller::PassBindingsCacheMTL::SetDepthStencilState | ( | id< MTLDepthStencilState > | depth_stencil | ) |
Set the depth and stencil state for the current encoder.
If this matches the previous depth and stencil state, no update is performed.
Definition at line 22 of file pass_bindings_cache_mtl.mm.
void impeller::PassBindingsCacheMTL::SetEncoder | ( | id< MTLRenderCommandEncoder > | encoder | ) |
Set the command encoder for this pass bindings cache.
The encoder must be set before any state adjusting commands can be called.
Definition at line 9 of file pass_bindings_cache_mtl.mm.
void impeller::PassBindingsCacheMTL::SetRenderPipelineState | ( | id< MTLRenderPipelineState > | pipeline | ) |
Set the render pipeline state for the current encoder.
If this matches the previous render pipeline state, no update is performed.
Definition at line 13 of file pass_bindings_cache_mtl.mm.
bool impeller::PassBindingsCacheMTL::SetSampler | ( | ShaderStage | stage, |
uint64_t | index, | ||
id< MTLSamplerState > | sampler | ||
) |
Set the sampler for the given stage and binding.
If the same sampler is already bound at the index for this stage, no state updates are performed.
Definition at line 99 of file pass_bindings_cache_mtl.mm.
References impeller::kFragment, impeller::kVertex, and VALIDATION_LOG.
Referenced by impeller::Bind().
void impeller::PassBindingsCacheMTL::SetScissor | ( | const IRect & | scissor | ) |
Set the encoder scissor rect if the value is different from the current encoder state.
Definition at line 138 of file pass_bindings_cache_mtl.mm.
References impeller::TRect< T >::GetHeight(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::GetX(), and impeller::TRect< T >::GetY().
void impeller::PassBindingsCacheMTL::SetStencilRef | ( | uint32_t | stencil_ref | ) |
Set the encoder's stencil reference if the value is different from the current encoder state.
Definition at line 152 of file pass_bindings_cache_mtl.mm.
bool impeller::PassBindingsCacheMTL::SetTexture | ( | ShaderStage | stage, |
uint64_t | index, | ||
id< MTLTexture > | texture | ||
) |
Set the texture for the given stage and binding.
If the same texture is already bound at the index for this stage, no state updates are performed.
Definition at line 75 of file pass_bindings_cache_mtl.mm.
References impeller::kFragment, impeller::kVertex, and VALIDATION_LOG.
Referenced by impeller::Bind().
void impeller::PassBindingsCacheMTL::SetViewport | ( | const Viewport & | viewport | ) |
Set the viewport if the value is different from the current encoder state.
Definition at line 123 of file pass_bindings_cache_mtl.mm.
References impeller::Viewport::depth_range, impeller::TRect< T >::GetHeight(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::GetX(), impeller::TRect< T >::GetY(), impeller::Viewport::rect, impeller::DepthRange::z_far, and impeller::DepthRange::z_near.