46void GLVaoCache::init()
50 is_dynamic_vao_count =
false;
55 vao_base_instance_ = 0;
63 if (!is_dynamic_vao_count) {
84 is_dynamic_vao_count =
true;
94 if (is_dynamic_vao_count) {
124 for (
int i = 0; i <
count; i++) {
126 context_->vao_free(vaos[i]);
134 interface_ =
nullptr;
147 if (context_ ==
nullptr) {
151 if (context_ == ctx) {
152 glDeleteVertexArrays(
count, vaos);
153 glDeleteVertexArrays(1, &vao_base_instance_);
157 for (
int i = 0; i <
count; i++) {
158 context_->vao_free(vaos[i]);
160 context_->vao_free(vao_base_instance_);
163 for (
int i = 0; i <
count; i++) {
169 if (is_dynamic_vao_count) {
175 context_->vao_cache_unregister(
this);
186 for (
int i = 0; i <
count; i++) {
194void GLVaoCache::context_check()
199 if (context_ != ctx) {
200 if (context_ !=
nullptr) {
213 this->context_check();
219 vao_id_ = this->
lookup(interface_);
223 glGenVertexArrays(1, &vao_id_);
224 this->
insert(interface_, vao_id_);
258 GLenum gl_type =
to_gl(prim_type);
266 glDrawElementsInstancedBaseVertexBaseInstance(
267 gl_type, v_count, index_type, v_first_ofs, i_count, base_index, i_first);
270 glDrawArraysInstancedBaseInstance(gl_type, v_first, v_count, i_count, i_first);
281 GLenum gl_type =
to_gl(prim_type);
285 glDrawElementsIndirect(gl_type, index_type, (GLvoid *)offset);
288 glDrawArraysIndirect(gl_type, (GLvoid *)offset);
291 glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0);
304 GLenum gl_type =
to_gl(prim_type);
308 glMultiDrawElementsIndirect(gl_type, index_type, (GLvoid *)offset,
count, stride);
311 glMultiDrawArraysIndirect(gl_type, (GLvoid *)offset,
count, stride);
314 glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0);
#define GPU_BATCH_VAO_DYN_ALLOC_COUNT
#define MEM_recallocN(vmemh, len)
StateManager * state_manager
void multi_draw_indirect(GPUStorageBuf *indirect_buf, int count, intptr_t offset, intptr_t stride) override
GLIndexBuf * elem_() const
void draw(int v_first, int v_count, int i_first, int i_count) override
void draw_indirect(GPUStorageBuf *indirect_buf, intptr_t offset) override
void vao_cache_unregister(GLVaoCache *cache)
void vao_cache_register(GLVaoCache *cache)
void * offset_ptr(uint additional_vertex_offset) const
struct blender::gpu::GLVaoCache::@130343304023251126342303033023164132041336015127::@107357316127075164333315357174177077117176260227 static_vaos
GLuint lookup(const GLShaderInterface *interface)
const GLShaderInterface * interfaces[GPU_VAO_STATIC_LEN]
struct blender::gpu::GLVaoCache::@130343304023251126342303033023164132041336015127::@035051266101205326100211155175363063021121162251 dynamic_vaos
GLuint vao_get(Batch *batch)
void insert(const GLShaderInterface *interface, GLuint vao_id)
void remove(const GLShaderInterface *interface)
GPUIndexBufType index_type_
virtual void apply_state()=0
#define GL_CHECK_RESOURCES(info)
struct @157336070235062372277311340362362342103123126032::@262166344314164341202215145112231240022370055142 batch
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
#define GPU_VAO_STATIC_LEN
void update_bindings(const GLuint vao, const Batch *batch, const ShaderInterface *interface, int base_instance)
static Context * unwrap(GPUContext *ctx)
static GLenum to_gl(const GPUAttachmentType type)