Blender V5.3
blender::gpu::VKVertexAttributeObjectCache Class Reference

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

Detailed Description

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.

Member Function Documentation

◆ clear()

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().

◆ get_or_create()

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().

Member Data Documentation

◆ CACHE_LEN

int blender::gpu::VKVertexAttributeObjectCache::CACHE_LEN = 16
staticconstexpr

Definition at line 31 of file vk_vertex_attribute_object_cache.hh.

Referenced by clear(), and get_or_create().


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