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 04:01:13 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-13 15:20:23 +0300
commit93165cbf478af8f5297a729fa05d387d6070b02d (patch)
tree18d7646e43ddf8001e098037104e230636bdd2e7 /source/blender/editors
parentde4eb115ac218dc053ef2f61b890a9b935ebf508 (diff)
GPUBatch: Remove most use of GPU_batch_draw_advanced()
This is in order to better encapsulate / isolate the drawing code.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_widgets.c5
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c5
-rw-r--r--source/blender/editors/space_view3d/view3d_placement.c6
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c8
4 files changed, 5 insertions, 19 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index d5541bd288d..1be62e535de 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1181,10 +1181,7 @@ void UI_widgetbase_draw_cache_flush(void)
MAX_WIDGET_PARAMETERS * MAX_WIDGET_BASE_BATCH,
(float *)g_widget_base_batch.params);
GPU_batch_uniform_3fv(batch, "checkerColorAndSize", checker_params);
- GPU_matrix_bind(batch->interface);
- GPU_shader_set_srgb_uniform(batch->interface);
- GPU_batch_bind(batch);
- GPU_batch_draw_advanced(batch, 0, 0, 0, g_widget_base_batch.count);
+ GPU_batch_draw_instanced(batch, g_widget_base_batch.count);
}
g_widget_base_batch.count = 0;
}
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 628178f0d0e..8855840d001 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1147,7 +1147,6 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_POINTS, vert, NULL, GPU_BATCH_OWNS_VBO);
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR);
- GPU_batch_bind(batch);
/* draw any snapped verts first */
rgba_uchar_to_float(fcol, kcd->colors.point_a);
@@ -1156,7 +1155,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
GPU_shader_set_srgb_uniform(batch->interface);
GPU_point_size(11);
if (snapped_verts_count > 0) {
- GPU_batch_draw_advanced(batch, 0, snapped_verts_count, 0, 0);
+ GPU_batch_draw_range(batch, 0, snapped_verts_count);
}
/* now draw the rest */
@@ -1164,7 +1163,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
GPU_batch_uniform_4fv(batch, "color", fcol);
GPU_point_size(7);
if (other_verts_count > 0) {
- GPU_batch_draw_advanced(batch, snapped_verts_count, other_verts_count, 0, 0);
+ GPU_batch_draw_range(batch, snapped_verts_count, other_verts_count);
}
GPU_batch_discard(batch);
diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c
index 91f2347d5ff..a21c1458286 100644
--- a/source/blender/editors/space_view3d/view3d_placement.c
+++ b/source/blender/editors/space_view3d/view3d_placement.c
@@ -262,8 +262,6 @@ static void draw_line_loop(const float coords[][3], int coords_len, const float
GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_LINE_LOOP, vert, NULL, GPU_BATCH_OWNS_VBO);
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
- GPU_batch_bind(batch);
-
GPU_batch_uniform_4fv(batch, "color", color);
float viewport[4];
@@ -297,8 +295,6 @@ static void draw_line_pairs(const float coords_a[][3],
GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_LINES, vert, NULL, GPU_BATCH_OWNS_VBO);
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
- GPU_batch_bind(batch);
-
GPU_batch_uniform_4fv(batch, "color", color);
float viewport[4];
@@ -347,8 +343,6 @@ static void draw_line_bounds(const BoundBox *bounds, const float color[4])
GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_LINES, vert, NULL, GPU_BATCH_OWNS_VBO);
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
- GPU_batch_bind(batch);
-
GPU_batch_uniform_4fv(batch, "color", color);
float viewport[4];
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index ae656d95f2d..a4fe511d816 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -288,10 +288,6 @@ static void draw_uvs_texpaint(const Scene *scene, Object *ob, Depsgraph *depsgra
uint idx = 0;
bool prev_ma_match = (mpoly->mat_nr == (ob_eval->actcol - 1));
- GPU_matrix_bind(geom->interface);
- GPU_shader_set_srgb_uniform(geom->interface);
- GPU_batch_bind(geom);
-
/* TODO(fclem): If drawcall count becomes a problem in the future
* we can use multi draw indirect drawcalls for this.
* (not implemented in GPU module at the time of writing). */
@@ -299,7 +295,7 @@ static void draw_uvs_texpaint(const Scene *scene, Object *ob, Depsgraph *depsgra
bool ma_match = (mpoly->mat_nr == (ob_eval->actcol - 1));
if (ma_match != prev_ma_match) {
if (ma_match == false) {
- GPU_batch_draw_advanced(geom, draw_start, idx - draw_start, 0, 0);
+ GPU_batch_draw_range(geom, draw_start, idx - draw_start);
}
else {
draw_start = idx;
@@ -309,7 +305,7 @@ static void draw_uvs_texpaint(const Scene *scene, Object *ob, Depsgraph *depsgra
prev_ma_match = ma_match;
}
if (prev_ma_match == true) {
- GPU_batch_draw_advanced(geom, draw_start, idx - draw_start, 0, 0);
+ GPU_batch_draw_range(geom, draw_start, idx - draw_start);
}
}
else {