[Bf-blender-cvs] [aa2ef3db7ab] tmp-gpu-shader-descriptor-2: Fix compilation issues GPU_SHADER_3D_FLAT_COLOR.

Jeroen Bakker noreply at git.blender.org
Fri Jan 7 12:06:06 CET 2022


Commit: aa2ef3db7abbe3e0c4a706fdfe4dbdad490a3c05
Author: Jeroen Bakker
Date:   Fri Jan 7 09:30:05 2022 +0100
Branches: tmp-gpu-shader-descriptor-2
https://developer.blender.org/rBaa2ef3db7abbe3e0c4a706fdfe4dbdad490a3c05

Fix compilation issues GPU_SHADER_3D_FLAT_COLOR.

===================================================================

M	source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl
M	source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh

===================================================================

diff --git a/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
index 5b6a890ccc8..192d26fe436 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
@@ -1,17 +1,18 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
-#ifdef USE_WORLD_CLIP_PLANES
+#  ifdef USE_WORLD_CLIP_PLANES
 uniform mat4 ModelMatrix;
-#endif
+#  endif
 
 in vec3 pos;
-#if defined(USE_COLOR_U32)
+#  if defined(USE_COLOR_U32)
 in uint color;
-#else
+#  else
 in vec4 color;
-#endif
+#  endif
 
 flat out vec4 finalColor;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl
index 99d8b6ab685..1675de3d567 100644
--- a/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl
@@ -1,6 +1,7 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 flat in vec4 finalColor;
 out vec4 fragColor;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh
index c22e89227ac..a16e9f215a5 100644
--- a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh
+++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh
@@ -5,12 +5,14 @@ GPU_SHADER_INTERFACE_INFO(flat_color_iface, "").flat(Type::VEC4, "finalColor");
 
 GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color)
     .vertex_in(0, Type::VEC3, "pos")
-    .vertex_in(1, Type::VEC4, "col")
+    .vertex_in(1, Type::VEC4, "color")
     .vertex_out(flat_color_iface)
     .fragment_out(0, Type::VEC4, "fragColor")
+    .push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
     .push_constant(1, Type::BOOL, "srgbTarget")
     .vertex_source("gpu_shader_3D_flat_color_vert.glsl")
     .fragment_source("gpu_shader_flat_color_frag.glsl")
+    .additional_info("gpu_srgb_to_framebuffer_space")
     .do_static_compilation(true);
 
 GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped)



More information about the Bf-blender-cvs mailing list