Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-08-09 00:37:43 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-13 15:20:23 +0300
commit186abf7d3bab9ed8b905c6914de02427bb2547cf (patch)
tree0f442dec935f30192eaf50300fb65d5553f6d718 /source/blender/gpu
parent38ef35b1ed1d38ab58c7d7fb121f4f3b33869810 (diff)
GPUBatch: Remove usage of gl_prim_type outside of GPU module
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_batch.h2
-rw-r--r--source/blender/gpu/intern/gpu_batch.cc14
-rw-r--r--source/blender/gpu/opengl/gl_drawlist.cc4
3 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h
index 4b79b175fec..fb273847a9c 100644
--- a/source/blender/gpu/GPU_batch.h
+++ b/source/blender/gpu/GPU_batch.h
@@ -57,7 +57,7 @@ typedef struct GPUBatch {
GPUVertBuf *inst[GPU_BATCH_INST_VBO_MAX_LEN];
/** NULL if element list not needed */
GPUIndexBuf *elem;
- uint32_t gl_prim_type;
+ GPUPrimType prim_type;
/* cached values (avoid dereferencing later) */
uint32_t vao_id;
diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc
index 5b8a3c4636b..0c82279fe6e 100644
--- a/source/blender/gpu/intern/gpu_batch.cc
+++ b/source/blender/gpu/intern/gpu_batch.cc
@@ -115,7 +115,7 @@ void GPU_batch_init_ex(
batch->inst[v] = NULL;
}
batch->elem = elem;
- batch->gl_prim_type = convert_prim_type_to_gl(prim_type);
+ batch->prim_type = prim_type;
batch->phase = GPU_BATCH_READY_TO_DRAW;
batch->is_dynamic_vao_count = false;
batch->owns_flag = owns_flag;
@@ -127,7 +127,7 @@ void GPU_batch_copy(GPUBatch *batch_dst, GPUBatch *batch_src)
{
GPU_batch_init_ex(batch_dst, GPU_PRIM_POINTS, batch_src->verts[0], batch_src->elem, 0);
- batch_dst->gl_prim_type = batch_src->gl_prim_type;
+ batch_dst->prim_type = batch_src->prim_type;
for (int v = 1; v < GPU_BATCH_VBO_MAX_LEN; v++) {
batch_dst->verts[v] = batch_src->verts[v];
}
@@ -744,6 +744,8 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_fi
}
}
+ GLenum gl_prim_type = convert_prim_type_to_gl(batch->prim_type);
+
if (batch->elem) {
const GPUIndexBuf *el = batch->elem;
GLenum index_type = INDEX_TYPE(el);
@@ -752,11 +754,11 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_fi
if (GPU_arb_base_instance_is_supported()) {
glDrawElementsInstancedBaseVertexBaseInstance(
- batch->gl_prim_type, v_count, index_type, v_first_ofs, i_count, base_index, i_first);
+ gl_prim_type, v_count, index_type, v_first_ofs, i_count, base_index, i_first);
}
else {
glDrawElementsInstancedBaseVertex(
- batch->gl_prim_type, v_count, index_type, v_first_ofs, i_count, base_index);
+ gl_prim_type, v_count, index_type, v_first_ofs, i_count, base_index);
}
}
else {
@@ -764,10 +766,10 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_fi
glDisable(GL_PRIMITIVE_RESTART);
#endif
if (GPU_arb_base_instance_is_supported()) {
- glDrawArraysInstancedBaseInstance(batch->gl_prim_type, v_first, v_count, i_count, i_first);
+ glDrawArraysInstancedBaseInstance(gl_prim_type, v_first, v_count, i_count, i_first);
}
else {
- glDrawArraysInstanced(batch->gl_prim_type, v_first, v_count, i_count);
+ glDrawArraysInstanced(gl_prim_type, v_first, v_count, i_count);
}
#ifdef __APPLE__
glEnable(GL_PRIMITIVE_RESTART);
diff --git a/source/blender/gpu/opengl/gl_drawlist.cc b/source/blender/gpu/opengl/gl_drawlist.cc
index 3fc6985e582..f24bfdc8751 100644
--- a/source/blender/gpu/opengl/gl_drawlist.cc
+++ b/source/blender/gpu/opengl/gl_drawlist.cc
@@ -33,6 +33,7 @@
#include "gpu_context_private.hh"
#include "gpu_drawlist_private.hh"
+#include "gpu_primitive_private.h"
#include "gl_backend.hh"
#include "gl_drawlist.hh"
@@ -193,8 +194,7 @@ void GLDrawList::submit(void)
* case where only a few instances are needed to finish filling a call buffer. */
const bool is_finishing_a_buffer = (command_offset_ >= data_size_);
if (command_len_ > 2 || is_finishing_a_buffer) {
- // GLenum prim = convert_prim_type_to_gl(batch_->prim_type);
- GLenum prim = batch_->gl_prim_type;
+ GLenum prim = convert_prim_type_to_gl(batch_->prim_type);
void *offset = (void *)data_offset_;
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, buffer_id_);