[Bf-blender-cvs] [c9589296171] tmp-gpu-shader-descriptor-2: Migrate GPU_SHADER_2D_CHECKER.

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


Commit: c958929617170dcb19775420734afd9c51957112
Author: Jeroen Bakker
Date:   Fri Jan 7 11:00:32 2022 +0100
Branches: tmp-gpu-shader-descriptor-2
https://developer.blender.org/rBc958929617170dcb19775420734afd9c51957112

Migrate GPU_SHADER_2D_CHECKER.

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

M	source/blender/gpu/CMakeLists.txt
M	source/blender/gpu/shaders/gpu_shader_2D_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_checker_frag.glsl
A	source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh

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

diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 92045abda93..1b535408226 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -420,6 +420,8 @@ shaders/infos/gpu_clip_planes_info.hh
 shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
 #shaders/infos/gpu_shader_3D_flat_color_info.hh
 shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh
+shaders/infos/gpu_shader_2D_checker_info.hh
+#shaders/infos/gpu_shader_simple_lighting_info.hh
 shaders/infos/gpu_shader_text_info.hh
 shaders/infos/gpu_shader_keyframe_shape_info.hh
 )
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl
index de6547715f3..698f20ae1f9 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl
@@ -1,11 +1,13 @@
 
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 
-#ifdef UV_POS
+#  ifdef UV_POS
 in vec2 u;
-#  define pos u
-#else
+#    define pos u
+#  else
 in vec2 pos;
+#  endif
 #endif
 
 void main()
diff --git a/source/blender/gpu/shaders/gpu_shader_checker_frag.glsl b/source/blender/gpu/shaders/gpu_shader_checker_frag.glsl
index 156b6cb75ab..9065da0275a 100644
--- a/source/blender/gpu/shaders/gpu_shader_checker_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_checker_frag.glsl
@@ -1,9 +1,10 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform vec4 color1;
 uniform vec4 color2;
 uniform int size;
 
 out vec4 fragColor;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh
new file mode 100644
index 00000000000..044ef7283ac
--- /dev/null
+++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh
@@ -0,0 +1,13 @@
+
+#include "gpu_shader_create_info.hh"
+
+GPU_SHADER_CREATE_INFO(gpu_shader_2D_checker)
+    .vertex_in(0, Type::VEC2, "pos")
+    .fragment_out(0, Type::VEC4, "fragColor")
+    .push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
+    .push_constant(16, Type::VEC4, "color1")
+    .push_constant(20, Type::VEC4, "color2")
+    .push_constant(24, Type::INT, "size")
+    .vertex_source("gpu_shader_2D_vert.glsl")
+    .fragment_source("gpu_shader_checker_frag.glsl")
+    .do_static_compilation(true);



More information about the Bf-blender-cvs mailing list