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>2022-05-02 01:44:58 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-05-02 01:44:58 +0300
commit5e5e198bbef843e28bcb91662dc1facafe6e5238 (patch)
tree8387e304c6760f2ad19f09413304a30050f0d7c1 /source/blender/gpu
parent0676963809a4800f1f666cd559c30885d79f66b8 (diff)
GPUShader: Port 3D uniform color clipped shaders to use shaderCreateInfo
This should have no functional changes.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_shader_builtin.c3
-rw-r--r--source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh17
2 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c b/source/blender/gpu/intern/gpu_shader_builtin.c
index 0463262b779..6ab077da413 100644
--- a/source/blender/gpu/intern/gpu_shader_builtin.c
+++ b/source/blender/gpu/intern/gpu_shader_builtin.c
@@ -223,8 +223,7 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
[GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR] =
{
.name = "GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR",
- .vert = datatoc_gpu_shader_3D_clipped_uniform_color_vert_glsl,
- .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
+ .create_info = "gpu_shader_3D_clipped_uniform_color",
},
[GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR] = {.name = "GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR",
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh
index 096ae4d922c..369fe3ac293 100644
--- a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh
+++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh
@@ -19,4 +19,19 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color)
GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color_clipped)
.additional_info("gpu_shader_3D_uniform_color")
- .additional_info("gpu_clip_planes");
+ .additional_info("gpu_clip_planes")
+ .do_static_compilation(true);
+
+/* Confusing naming convention. But this is a version with only one local clip plane. */
+GPU_SHADER_CREATE_INFO(gpu_shader_3D_clipped_uniform_color)
+ .vertex_in(0, Type::VEC3, "pos")
+ .fragment_out(0, Type::VEC4, "fragColor")
+ .push_constant(Type::MAT4, "ModelViewProjectionMatrix")
+ .push_constant(Type::VEC4, "color")
+ /* TODO(fclem): Put thoses two to one UBO. */
+ .push_constant(Type::MAT4, "ModelMatrix")
+ .push_constant(Type::VEC4, "ClipPlane")
+ .vertex_source("gpu_shader_3D_clipped_uniform_color_vert.glsl")
+ .fragment_source("gpu_shader_uniform_color_frag.glsl")
+ .additional_info("gpu_srgb_to_framebuffer_space")
+ .do_static_compilation(true);