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:
authorGermano Cavalcante <germano.costa@ig.com.br>2022-09-06 01:01:02 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-09-06 01:01:02 +0300
commitf0a36599007d2c5185d040202b84775ae1343785 (patch)
treecce02857382c06e80e48a50c5d47fe2583938cfe /source/blender/gpu
parent755e728a98401e2ef417368332c35e949f2233b7 (diff)
GPU: remove 'GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR'
The only difference between `GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR` and `GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR` is that in the vertex shader the 2D version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses `vec4(pos, 1.0)`. But VBOs with 2D attributes work perfectly in shaders that use 3D attributes. Components not specified are filled with components from `vec4(0.0, 0.0, 0.0, 1.0)`. So there is no real benefit to having two different shader versions.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/CMakeLists.txt1
-rw-r--r--source/blender/gpu/GPU_shader.h1
-rw-r--r--source/blender/gpu/intern/gpu_shader_builtin.c5
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl13
-rw-r--r--source/blender/gpu/shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh18
-rw-r--r--source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh15
6 files changed, 3 insertions, 50 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 7ceebc37fb4..25912c6d978 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -272,7 +272,6 @@ set(GLSL_SRC
shaders/gpu_shader_2D_widget_shadow_frag.glsl
shaders/gpu_shader_2D_nodelink_frag.glsl
shaders/gpu_shader_2D_nodelink_vert.glsl
- shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl
shaders/gpu_shader_2D_line_dashed_frag.glsl
shaders/gpu_shader_2D_image_vert.glsl
shaders/gpu_shader_2D_image_rect_vert.glsl
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 35ed0f6678e..c1b3b879c34 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -343,7 +343,6 @@ typedef enum eGPUBuiltinShader {
*/
GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR,
/* lines */
- GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR,
GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR,
/* grease pencil drawing */
GPU_SHADER_GPENCIL_STROKE,
diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c b/source/blender/gpu/intern/gpu_shader_builtin.c
index 2944905f2dd..8a6586e06f6 100644
--- a/source/blender/gpu/intern/gpu_shader_builtin.c
+++ b/source/blender/gpu/intern/gpu_shader_builtin.c
@@ -235,11 +235,6 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
.create_info = "gpu_shader_3D_polyline_smooth_color",
},
- [GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR] =
- {
- .name = "GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR",
- .create_info = "gpu_shader_2D_line_dashed_uniform_color",
- },
[GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR] =
{
.name = "GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR",
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl
deleted file mode 100644
index 7878dc18362..00000000000
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl
+++ /dev/null
@@ -1,13 +0,0 @@
-
-/*
- * Vertex Shader for dashed lines with 2D coordinates,
- * with uniform multi-colors or uniform single-color, and unary thickness.
- *
- * Dashed is performed in screen space.
- */
-
-void main()
-{
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
- stipple_start = stipple_pos = viewport_size * 0.5 * (gl_Position.xy / gl_Position.w);
-}
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh
deleted file mode 100644
index 2987077ffba..00000000000
--- a/source/blender/gpu/shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright 2022 Blender Foundation. All rights reserved. */
-
-/** \file
- * \ingroup gpu
- */
-
-#include "gpu_interface_info.hh"
-#include "gpu_shader_create_info.hh"
-
-/* TODO(jbakker): Skipped as data doesn't fit as push constant. */
-GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
- .vertex_in(0, Type::VEC3, "pos")
- .vertex_out(flat_color_iface)
- .push_constant(Type::MAT4, "ModelViewProjectionMatrix")
- .vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl")
- .fragment_source("gpu_shader_2D_line_dashed_frag.glsl")
- .do_static_compilation(true);
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh
index 57cb02c8484..a2ac08c689b 100644
--- a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh
+++ b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh
@@ -13,7 +13,8 @@ GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface, "")
.no_perspective(Type::VEC2, "stipple_start") /* In screen space */
.flat(Type::VEC2, "stipple_pos"); /* In screen space */
-GPU_SHADER_CREATE_INFO(gpu_shader_line_dashed)
+GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
+ .vertex_in(0, Type::VEC3, "pos")
.vertex_out(flat_color_iface)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC2, "viewport_size")
@@ -25,18 +26,8 @@ GPU_SHADER_CREATE_INFO(gpu_shader_line_dashed)
.push_constant(Type::VEC4, "color2")
.vertex_out(gpu_shader_line_dashed_interface)
.fragment_out(0, Type::VEC4, "fragColor")
- .fragment_source("gpu_shader_2D_line_dashed_frag.glsl");
-
-GPU_SHADER_CREATE_INFO(gpu_shader_2D_line_dashed_uniform_color)
- .vertex_in(0, Type::VEC2, "pos")
- .vertex_source("gpu_shader_2D_line_dashed_uniform_color_vert.glsl")
- .additional_info("gpu_shader_line_dashed")
- .do_static_compilation(true);
-
-GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
- .vertex_in(0, Type::VEC3, "pos")
.vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl")
- .additional_info("gpu_shader_line_dashed")
+ .fragment_source("gpu_shader_2D_line_dashed_frag.glsl")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped)