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-09-06 03:46:51 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-06 23:13:06 +0300
commit4ea93029c65fd4cdb8b707494855120c0f792952 (patch)
treea02801daaaf0f0a4e1bb7be84d34e27759b32a36 /source/blender/gpu/intern/gpu_batch.cc
parent84d67bd0a937e842618ee7843958f3147ba6af58 (diff)
GPUIndexBuf: GL backend Isolation
This is part of the Vulkan backend task T68990. There is no real change, only making some code re-organisation. This also make the IndexBuf completely abstract from outside the GPU module.
Diffstat (limited to 'source/blender/gpu/intern/gpu_batch.cc')
-rw-r--r--source/blender/gpu/intern/gpu_batch.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc
index 0b0c88a42e2..75419e1a242 100644
--- a/source/blender/gpu/intern/gpu_batch.cc
+++ b/source/blender/gpu/intern/gpu_batch.cc
@@ -38,13 +38,10 @@
#include "gpu_backend.hh"
#include "gpu_batch_private.hh"
#include "gpu_context_private.hh"
+#include "gpu_index_buffer_private.hh"
#include "gpu_shader_private.hh"
#include "gpu_vertex_format_private.h"
-#include "gl_primitive.hh" /* TODO remove */
-
-#include <limits.h>
-#include <stdlib.h>
#include <string.h>
using namespace blender::gpu;
@@ -257,12 +254,19 @@ void GPU_batch_draw_instanced(GPUBatch *batch, int i_count)
GPU_shader_unbind();
}
-void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_first, int i_count)
+void GPU_batch_draw_advanced(
+ GPUBatch *gpu_batch, int v_first, int v_count, int i_first, int i_count)
{
BLI_assert(GPU_context_active_get()->shader != NULL);
+ Batch *batch = static_cast<Batch *>(gpu_batch);
if (v_count == 0) {
- v_count = (batch->elem) ? batch->elem->index_len : batch->verts[0]->vertex_len;
+ if (batch->elem) {
+ v_count = batch->elem_()->index_len_get();
+ }
+ else {
+ v_count = batch->verts[0]->vertex_len;
+ }
}
if (i_count == 0) {
i_count = (batch->inst[0]) ? batch->inst[0]->vertex_len : 1;
@@ -277,7 +281,7 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_fi
return;
}
- static_cast<Batch *>(batch)->draw(v_first, v_count, i_first, i_count);
+ batch->draw(v_first, v_count, i_first, i_count);
}
/** \} */