diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-01 16:04:00 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-05 22:34:05 +0300 |
commit | baf2835ff746b4ac1b8b2478be8aea9928604970 (patch) | |
tree | 08766ee8bb6b112e35e9da001ea80836eea16cef /source/blender/gpu | |
parent | 223665b994d785672c023432ac3861d4d2c0ffb6 (diff) |
GPU: remove 'GPU_SHADER_2D_FLAT_COLOR'
The only real difference between `GPU_SHADER_2D_FLAT_COLOR` and
`GPU_SHADER_3D_FLAT_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.
This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.
In python the new name for '2D_FLAT_COLOR'' and '3D_FLAT_COLOR'
is 'FLAT_COLOR', but the old names still work for backward
compatibility.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/gpu/GPU_shader.h | 7 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate.cc | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_builtin.c | 6 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl | 6 | ||||
-rw-r--r-- | source/blender/gpu/shaders/infos/gpu_shader_2D_flat_color_info.hh | 21 |
6 files changed, 0 insertions, 43 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 6c7e03b0994..d1b0e227506 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_flat_color_vert.glsl shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl shaders/gpu_shader_2D_line_dashed_frag.glsl shaders/gpu_shader_2D_smooth_color_vert.glsl @@ -577,7 +576,6 @@ set(SRC_SHADER_CREATE_INFOS shaders/infos/gpu_shader_2D_area_borders_info.hh shaders/infos/gpu_shader_2D_checker_info.hh shaders/infos/gpu_shader_2D_diag_stripes_info.hh - shaders/infos/gpu_shader_2D_flat_color_info.hh shaders/infos/gpu_shader_2D_image_color_info.hh shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh shaders/infos/gpu_shader_2D_image_info.hh diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index dcf63507f89..65a628bcd76 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -207,13 +207,6 @@ typedef enum eGPUBuiltinShader { GPU_SHADER_KEYFRAME_SHAPE, GPU_SHADER_SIMPLE_LIGHTING, /** - * Take a 2D position and color for each vertex without color interpolation. - * - * \param color: in vec4 - * \param pos: in vec2 - */ - GPU_SHADER_2D_FLAT_COLOR, - /** * Take a 2D position and color for each vertex with linear interpolation in window space. * * \param color: in vec4 diff --git a/source/blender/gpu/intern/gpu_immediate.cc b/source/blender/gpu/intern/gpu_immediate.cc index be1972beab6..8574e886cd0 100644 --- a/source/blender/gpu/intern/gpu_immediate.cc +++ b/source/blender/gpu/intern/gpu_immediate.cc @@ -134,7 +134,6 @@ static void wide_line_workaround_start(GPUPrimType prim_type) case GPU_SHADER_3D_UNIFORM_COLOR: polyline_sh = GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR; break; - case GPU_SHADER_2D_FLAT_COLOR: case GPU_SHADER_3D_FLAT_COLOR: polyline_sh = GPU_SHADER_3D_POLYLINE_FLAT_COLOR; break; diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c b/source/blender/gpu/intern/gpu_shader_builtin.c index 502363d97db..4776a8b9b12 100644 --- a/source/blender/gpu/intern/gpu_shader_builtin.c +++ b/source/blender/gpu/intern/gpu_shader_builtin.c @@ -25,7 +25,6 @@ extern char datatoc_gpu_shader_flat_id_frag_glsl[]; extern char datatoc_gpu_shader_2D_area_borders_vert_glsl[]; extern char datatoc_gpu_shader_2D_area_borders_frag_glsl[]; extern char datatoc_gpu_shader_2D_vert_glsl[]; -extern char datatoc_gpu_shader_2D_flat_color_vert_glsl[]; extern char datatoc_gpu_shader_2D_smooth_color_uniform_alpha_vert_glsl[]; extern char datatoc_gpu_shader_2D_smooth_color_vert_glsl[]; extern char datatoc_gpu_shader_2D_smooth_color_frag_glsl[]; @@ -156,11 +155,6 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = { .create_info = "gpu_shader_2D_diag_stripes", }, - [GPU_SHADER_2D_FLAT_COLOR] = - { - .name = "GPU_SHADER_2D_FLAT_COLOR", - .create_info = "gpu_shader_2D_flat_color", - }, [GPU_SHADER_2D_SMOOTH_COLOR] = { .name = "GPU_SHADER_2D_SMOOTH_COLOR", diff --git a/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl deleted file mode 100644 index cf948bb2533..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl +++ /dev/null @@ -1,6 +0,0 @@ - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - finalColor = color; -} diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_flat_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_flat_color_info.hh deleted file mode 100644 index 24a06a37a44..00000000000 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_flat_color_info.hh +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright 2022 Blender Foundation. All rights reserved. */ - -/** \file - * \ingroup gpu - */ - -#include "gpu_shader_create_info.hh" - -#include "gpu_interface_info.hh" - -GPU_SHADER_CREATE_INFO(gpu_shader_2D_flat_color) - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::VEC4, "color") - .vertex_out(flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_2D_flat_color_vert.glsl") - .fragment_source("gpu_shader_flat_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); |