diff options
Diffstat (limited to 'source/blender/gpu/opengl/gl_batch.cc')
-rw-r--r-- | source/blender/gpu/opengl/gl_batch.cc | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/source/blender/gpu/opengl/gl_batch.cc b/source/blender/gpu/opengl/gl_batch.cc index bb7d5654efd..c735d02500b 100644 --- a/source/blender/gpu/opengl/gl_batch.cc +++ b/source/blender/gpu/opengl/gl_batch.cc @@ -34,12 +34,14 @@ #include "gpu_batch_private.hh" #include "gpu_shader_private.hh" -#include "gl_batch.hh" #include "gl_context.hh" #include "gl_debug.hh" +#include "gl_index_buffer.hh" #include "gl_primitive.hh" #include "gl_vertex_array.hh" +#include "gl_batch.hh" + using namespace blender::gpu; /* -------------------------------------------------------------------- */ @@ -295,14 +297,6 @@ GLBatch::~GLBatch() /** \name Drawing * \{ */ -#if GPU_TRACK_INDEX_RANGE -# define BASE_INDEX(el) ((el)->base_index) -# define INDEX_TYPE(el) ((el)->gl_index_type) -#else -# define BASE_INDEX(el) 0 -# define INDEX_TYPE(el) GL_UNSIGNED_INT -#endif - void GLBatch::bind(int i_first) { GPU_context_active_get()->state_manager->apply_state(); @@ -315,7 +309,7 @@ void GLBatch::bind(int i_first) #if GPU_TRACK_INDEX_RANGE /* Can be removed if GL 4.3 is required. */ if (!GLEW_ARB_ES3_compatibility && (elem != NULL)) { - glPrimitiveRestartIndex((elem->index_type == GPU_INDEX_U16) ? 0xFFFFu : 0xFFFFFFFFu); + glPrimitiveRestartIndex(this->gl_elem()->restart_index()); } #endif @@ -340,16 +334,10 @@ void GLBatch::draw(int v_first, int v_count, int i_first, int i_count) GLenum gl_type = to_gl(prim_type); if (elem) { - const GPUIndexBuf *el = elem; - GLenum index_type = INDEX_TYPE(el); - GLint base_index = BASE_INDEX(el); - void *v_first_ofs = (GLuint *)0 + v_first + el->index_start; - -#if GPU_TRACK_INDEX_RANGE - if (el->index_type == GPU_INDEX_U16) { - v_first_ofs = (GLushort *)0 + v_first + el->index_start; - } -#endif + const GLIndexBuf *el = this->gl_elem(); + GLenum index_type = to_gl(el->index_type_); + GLint base_index = el->index_base_; + void *v_first_ofs = el->offset_ptr(v_first); if (GPU_arb_base_instance_is_supported()) { glDrawElementsInstancedBaseVertexBaseInstance( |