Blender V5.0
blender::gpu::GLVaoCache Class Reference

#include <gl_batch.hh>

VAO Cache

Each GLBatch has a small cache of VAO objects that are used to avoid VAO reconfiguration. TODO(fclem): Could be revisited to avoid so much cross references.

 GLVaoCache ()
 ~GLVaoCache ()
GLuint vao_get (Batch *batch)
GLuint lookup (const GLShaderInterface *interface)
void insert (const GLShaderInterface *interface, GLuint vao_id)
void remove (const GLShaderInterface *interface)
void clear ()

Detailed Description

VAO management: remembers all geometry state (vertex attribute bindings & element buffer) for each shader interface. Start with a static number of VAO's and fallback to dynamic count if necessary. Once a batch goes dynamic it does not go back.

Definition at line 34 of file gl_batch.hh.

Constructor & Destructor Documentation

◆ GLVaoCache()

GLVaoCache::GLVaoCache ( )

Definition at line 36 of file gl_batch.cc.

References init().

◆ ~GLVaoCache()

GLVaoCache::~GLVaoCache ( )

Definition at line 41 of file gl_batch.cc.

References clear().

Member Function Documentation

◆ clear()

void GLVaoCache::clear ( )

◆ insert()

void GLVaoCache::insert ( const GLShaderInterface * interface,
GLuint vao_id )

Create a new VAO object and store it in the cache.

Definition at line 60 of file gl_batch.cc.

References dynamic_vaos, GPU_BATCH_VAO_DYN_ALLOC_COUNT, GPU_VAO_STATIC_LEN, i, MEM_calloc_arrayN(), MEM_callocN(), MEM_recallocN, and static_vaos.

Referenced by vao_get().

◆ lookup()

GLuint GLVaoCache::lookup ( const GLShaderInterface * interface)

Return 0 on cache miss (invalid VAO).

Definition at line 180 of file gl_batch.cc.

References count, dynamic_vaos, GPU_VAO_STATIC_LEN, i, interfaces, and static_vaos.

Referenced by vao_get().

◆ remove()

void GLVaoCache::remove ( const GLShaderInterface * interface)

Definition at line 117 of file gl_batch.cc.

References count, dynamic_vaos, GPU_VAO_STATIC_LEN, i, interfaces, and static_vaos.

◆ vao_get()

GLuint GLVaoCache::vao_get ( Batch * batch)

Member Data Documentation

◆ count

uint blender::gpu::GLVaoCache::count

Definition at line 55 of file gl_batch.hh.

Referenced by clear(), lookup(), and remove().

◆ [struct]

struct { ... } blender::gpu::GLVaoCache::dynamic_vaos

Dynamic handle count

Referenced by clear(), insert(), lookup(), and remove().

◆ interfaces [1/2]

const GLShaderInterface** blender::gpu::GLVaoCache::interfaces

Definition at line 56 of file gl_batch.hh.

◆ interfaces [2/2]

const GLShaderInterface* blender::gpu::GLVaoCache::interfaces[GPU_VAO_STATIC_LEN]

Definition at line 50 of file gl_batch.hh.

Referenced by clear(), lookup(), and remove().

◆ [struct]

struct { ... } blender::gpu::GLVaoCache::static_vaos

Static handle count

Referenced by clear(), insert(), lookup(), and remove().

◆ vao_ids [1/2]

GLuint* blender::gpu::GLVaoCache::vao_ids

Definition at line 57 of file gl_batch.hh.

◆ vao_ids [2/2]

GLuint blender::gpu::GLVaoCache::vao_ids[GPU_VAO_STATIC_LEN]

Definition at line 51 of file gl_batch.hh.


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