|
Blender V5.3
|
Cache of VKVertexAttributeObjects keyed by VKShaderInterface. More...
#include <vk_vertex_attribute_object_cache.hh>
Public Member Functions | |
| const VKVertexAttributeObject & | get_or_create (VKContext &context, VKBatch &batch, VKShaderInterface::Key shader_key, VKVertexInputDescriptionPool &pool) |
| void | clear () |
Static Public Attributes | |
| static constexpr int | CACHE_LEN = 16 |
Cache of VKVertexAttributeObjects keyed by VKShaderInterface.
When a batch is drawn multiple times with the same shader, the vertex attribute object (bindings, attributes, buffer references) is reused, avoiding the expensive update_bindings() step.
The cache uses a fixed-size ring buffer. When full, the oldest entry is evicted. Entries are invalidated via clear(), typically when GPU_BATCH_DIRTY is set.
Definition at line 29 of file vk_vertex_attribute_object_cache.hh.
| void blender::gpu::VKVertexAttributeObjectCache::clear | ( | ) |
Clear all cache entries.
Definition at line 38 of file vk_vertex_attribute_object_cache.cc.
References CACHE_LEN, and blender::IndexRange::IndexRange().
| const VKVertexAttributeObject & blender::gpu::VKVertexAttributeObjectCache::get_or_create | ( | VKContext & | context, |
| VKBatch & | batch, | ||
| VKShaderInterface::Key | shader_key, | ||
| VKVertexInputDescriptionPool & | pool ) |
Get or create a cached VKVertexAttributeObject.
On cache hit the cached entry is returned and update_bindings() is skipped. On cache miss update_bindings() is called and the vertex_input_key is populated.
Definition at line 16 of file vk_vertex_attribute_object_cache.cc.
References CACHE_LEN, blender::IndexRange::IndexRange(), blender::gpu::VKVertexAttributeObject::update_bindings(), and blender::gpu::VKVertexAttributeObject::update_vertex_input_key().
|
staticconstexpr |
Definition at line 31 of file vk_vertex_attribute_object_cache.hh.
Referenced by clear(), and get_or_create().