From bb2aeb4504907cab1cf8c4afc4dd1d6495c940e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sun, 6 Sep 2020 23:45:51 +0200 Subject: GPUVertBuf: Rename GPUVertBuf to VertBuf and add some getters to avoid more typecasts. --- source/blender/gpu/opengl/gl_vertex_array.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source/blender/gpu/opengl/gl_vertex_array.cc') diff --git a/source/blender/gpu/opengl/gl_vertex_array.cc b/source/blender/gpu/opengl/gl_vertex_array.cc index bfd3bd6e6cc..463dc18cc60 100644 --- a/source/blender/gpu/opengl/gl_vertex_array.cc +++ b/source/blender/gpu/opengl/gl_vertex_array.cc @@ -28,6 +28,7 @@ #include "gl_batch.hh" #include "gl_context.hh" #include "gl_index_buffer.hh" +#include "gl_vertex_buffer.hh" #include "gl_vertex_array.hh" @@ -62,7 +63,7 @@ static uint16_t vbo_bind(const ShaderInterface *interface, } const GLvoid *pointer = (const GLubyte *)0 + offset + v_first * stride; - const GLenum type = convert_comp_type_to_gl(static_cast(a->comp_type)); + const GLenum type = to_gl(static_cast(a->comp_type)); for (uint n_idx = 0; n_idx < a->name_len; n_idx++) { const char *name = GPU_vertformat_attr_name_get(format, a, n_idx); @@ -108,27 +109,28 @@ static uint16_t vbo_bind(const ShaderInterface *interface, /* Update the Attrib Binding of the currently bound VAO. */ void GLVertArray::update_bindings(const GLuint vao, - const GPUBatch *batch, + const GPUBatch *batch_, /* Should be GLBatch. */ const ShaderInterface *interface, const int base_instance) { + const GLBatch *batch = static_cast(batch_); uint16_t attr_mask = interface->enabled_attr_mask_; glBindVertexArray(vao); /* Reverse order so first VBO'S have more prevalence (in term of attribute override). */ for (int v = GPU_BATCH_VBO_MAX_LEN - 1; v > -1; v--) { - GPUVertBuf *vbo = batch->verts[v]; + GLVertBuf *vbo = batch->verts_(v); if (vbo) { - GPU_vertbuf_use(vbo); + GPU_vertbuf_use(batch->verts[v]); attr_mask &= ~vbo_bind(interface, &vbo->format, 0, vbo->vertex_len, false); } } for (int v = GPU_BATCH_INST_VBO_MAX_LEN - 1; v > -1; v--) { - GPUVertBuf *vbo = batch->inst[v]; + GLVertBuf *vbo = batch->inst_(v); if (vbo) { - GPU_vertbuf_use(vbo); + GPU_vertbuf_use(batch->inst[v]); attr_mask &= ~vbo_bind(interface, &vbo->format, base_instance, vbo->vertex_len, true); } } -- cgit v1.2.3