|
Blender V5.3
|
#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 () |
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 33 of file gl_batch.hh.
| blender::GLVaoCache::GLVaoCache | ( | ) |
Definition at line 38 of file gl_batch.cc.
| blender::GLVaoCache::~GLVaoCache | ( | ) |
Definition at line 43 of file gl_batch.cc.
References clear().
| void blender::GLVaoCache::clear | ( | ) |
Definition at line 140 of file gl_batch.cc.
References blender::gpu::GLContext::get(), and GPU_VAO_STATIC_LEN.
Referenced by blender::gpu::GLBatch::bind(), and ~GLVaoCache().
| void blender::GLVaoCache::insert | ( | const GLShaderInterface * | interface, |
| GLuint | vao_id ) |
Create a new VAO object and store it in the cache.
Definition at line 62 of file gl_batch.cc.
References GPU_VAO_STATIC_LEN, blender::MEM_new_array_zeroed(), and MEM_realloc_zeroed.
Referenced by vao_get().
| GLuint blender::GLVaoCache::lookup | ( | const GLShaderInterface * | interface | ) |
Return 0 on cache miss (invalid VAO).
Definition at line 182 of file gl_batch.cc.
References GPU_VAO_STATIC_LEN.
Referenced by vao_get().
| void blender::GLVaoCache::remove | ( | const GLShaderInterface * | interface | ) |
Definition at line 119 of file gl_batch.cc.
References GPU_VAO_STATIC_LEN.
| GLuint blender::GLVaoCache::vao_get | ( | Batch * | batch | ) |
Definition at line 212 of file gl_batch.cc.
References blender::gpu::GLContext::get(), insert(), lookup(), blender::gpu::Context::shader, and blender::gpu::GLVertArray::update_bindings().
Referenced by blender::gpu::GLBatch::bind().