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:
-rw-r--r--source/blender/draw/intern/draw_debug.c38
-rw-r--r--source/blender/gpu/GPU_shader.h2
-rw-r--r--source/blender/gpu/intern/gpu_shader_builtin.c9
-rw-r--r--source/blender/gpu/tests/gpu_shader_builtin_test.cc1
4 files changed, 10 insertions, 40 deletions
diff --git a/source/blender/draw/intern/draw_debug.c b/source/blender/draw/intern/draw_debug.c
index ef085a135be..b568119627e 100644
--- a/source/blender/draw/intern/draw_debug.c
+++ b/source/blender/draw/intern/draw_debug.c
@@ -16,6 +16,7 @@
#include "BLI_link_utils.h"
#include "GPU_immediate.h"
+#include "GPU_matrix.h"
#include "draw_debug.h"
#include "draw_manager.h"
@@ -164,42 +165,23 @@ static void drw_debug_draw_spheres(void)
return;
}
- float one = 1.0f;
- GPUVertFormat vert_format = {0};
- uint mat = GPU_vertformat_attr_add(
- &vert_format, "InstanceModelMatrix", GPU_COMP_F32, 16, GPU_FETCH_FLOAT);
- uint col = GPU_vertformat_attr_add(&vert_format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- uint siz = GPU_vertformat_attr_add(&vert_format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
-
- GPUVertBuf *inst_vbo = GPU_vertbuf_create_with_format(&vert_format);
-
- GPU_vertbuf_data_alloc(inst_vbo, count);
+ float persmat[4][4];
+ DRW_view_persmat_get(NULL, persmat, false);
- int v = 0;
+ GPUBatch *empty_sphere = DRW_cache_empty_sphere_get();
+ GPU_batch_program_set_builtin(empty_sphere, GPU_SHADER_3D_UNIFORM_COLOR);
while (DST.debug.spheres) {
void *next = DST.debug.spheres->next;
+ float MVP[4][4];
- GPU_vertbuf_attr_set(inst_vbo, mat, v, DST.debug.spheres->mat[0]);
- GPU_vertbuf_attr_set(inst_vbo, col, v, DST.debug.spheres->color);
- GPU_vertbuf_attr_set(inst_vbo, siz, v, &one);
- v++;
+ mul_m4_m4m4(MVP, persmat, DST.debug.spheres->mat);
+ GPU_batch_uniform_mat4(empty_sphere, "ModelViewProjectionMatrix", MVP);
+ GPU_batch_uniform_4fv(empty_sphere, "color", DST.debug.spheres->color);
+ GPU_batch_draw(empty_sphere);
MEM_freeN(DST.debug.spheres);
DST.debug.spheres = next;
}
-
- GPUBatch *empty_sphere = DRW_cache_empty_sphere_get();
-
- GPUBatch *draw_batch = GPU_batch_create(GPU_PRIM_LINES, empty_sphere->verts[0], NULL);
- GPU_batch_instbuf_set(draw_batch, inst_vbo, true);
- GPU_batch_program_set_builtin(draw_batch, GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE);
-
- float persmat[4][4];
- DRW_view_persmat_get(NULL, persmat, false);
- GPU_batch_uniform_mat4(draw_batch, "ViewProjectionMatrix", persmat);
-
- GPU_batch_draw(draw_batch);
- GPU_batch_discard(draw_batch);
}
void drw_debug_draw(void)
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 0e7ce0889c2..b620fe9cc9d 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -338,8 +338,6 @@ typedef enum eGPUBuiltinShader {
/* lines */
GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR,
GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR,
- /* instance */
- GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, /* Uniformly scaled */
/* grease pencil drawing */
GPU_SHADER_GPENCIL_STROKE,
/* specialized for widget drawing */
diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c b/source/blender/gpu/intern/gpu_shader_builtin.c
index 6ab077da413..f6e416e7c48 100644
--- a/source/blender/gpu/intern/gpu_shader_builtin.c
+++ b/source/blender/gpu/intern/gpu_shader_builtin.c
@@ -266,14 +266,6 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
.create_info = "gpu_shader_3D_point_uniform_size_uniform_color_aa",
.clipped_create_info = "gpu_shader_3D_point_uniform_size_uniform_color_aa_clipped"},
- [GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE] =
- {
- .name = "GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE",
- .vert = datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl,
- .frag = datatoc_gpu_shader_flat_color_frag_glsl,
- .defs = "#define UNIFORM_SCALE\n",
- },
-
[GPU_SHADER_2D_AREA_BORDERS] = {.name = "GPU_SHADER_2D_AREA_BORDERS",
.create_info = "gpu_shader_2D_area_borders"},
[GPU_SHADER_2D_WIDGET_BASE] = {.name = "GPU_SHADER_2D_WIDGET_BASE",
@@ -326,7 +318,6 @@ GPUShader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader,
GPU_SHADER_3D_UNIFORM_COLOR,
GPU_SHADER_3D_SMOOTH_COLOR,
GPU_SHADER_3D_DEPTH_ONLY,
- GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE,
GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA,
GPU_SHADER_3D_FLAT_COLOR,
GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR));
diff --git a/source/blender/gpu/tests/gpu_shader_builtin_test.cc b/source/blender/gpu/tests/gpu_shader_builtin_test.cc
index 7ff047418fc..6ef8a032a73 100644
--- a/source/blender/gpu/tests/gpu_shader_builtin_test.cc
+++ b/source/blender/gpu/tests/gpu_shader_builtin_test.cc
@@ -26,7 +26,6 @@ static void test_shader_builtin()
test_compile_builtin_shader(GPU_SHADER_3D_SMOOTH_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_DEPTH_ONLY);
test_compile_builtin_shader(GPU_SHADER_3D_FLAT_COLOR);
- test_compile_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE);
test_compile_builtin_shader(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA);