[Bf-blender-cvs] [6e605978bf9] tmp-gpu-shader-descriptor-2: Migrated shaders.

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


Commit: 6e605978bf922211c4dfcf92c4814fc7d9a6be44
Author: Jeroen Bakker
Date:   Fri Jan 7 14:11:04 2022 +0100
Branches: tmp-gpu-shader-descriptor-2
https://developer.blender.org/rB6e605978bf922211c4dfcf92c4814fc7d9a6be44

Migrated shaders.

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

M	source/blender/gpu/CMakeLists.txt
M	source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_point_uniform_color_frag.glsl
M	source/blender/gpu/shaders/infos/gpu_interface_info.hh
A	source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh
A	source/blender/gpu/shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh
A	source/blender/gpu/shaders/infos/gpu_shader_2D_point_fixed_size_uniform_color_info.hh
M	source/blender/gpu/shaders/infos/gpu_shader_2D_smooth_color_info.hh
A	source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh
A	source/blender/gpu/shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh
A	source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh
A	source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh
A	source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh

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

diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index fe631e30d35..ce9f6032255 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -418,7 +418,7 @@ set(SHADER_CREATE_INFOS
 
 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 !Disabled due to failing compilation.
+#shaders/infos/gpu_shader_3D_flat_color_info.hh !Disabled due to world_clipping
 shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh
 #shaders/infos/gpu_shader_simple_lighting_info.hh !TODO
 shaders/infos/gpu_shader_2D_checker_info.hh
@@ -432,8 +432,19 @@ shaders/infos/gpu_shader_2D_image_info.hh
 shaders/infos/gpu_shader_2D_image_color_info.hh
 shaders/infos/gpu_shader_2D_image_desaturate_info.hh
 shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh
+shaders/infos/gpu_shader_2D_image_rect_color_info.hh
 shaders/infos/gpu_shader_text_info.hh
 shaders/infos/gpu_shader_keyframe_shape_info.hh
+#shaders/infos/gpu_shader_2D_image_multi_rect_color_info.hh !TODO
+#shaders/infos/gpu_shader_3D_uniform_color_info.hh !Disabled due to world clipping
+shaders/infos/gpu_shader_3D_smooth_color_info.hh
+shaders/infos/gpu_shader_3D_depth_only_info.hh
+#shaders/infos/gpu_shader_3D_polyline_info.hh !TODO
+#shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh
+#shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh
+shaders/infos/gpu_shader_2D_point_fixed_size_uniform_color_info.hh
+
+
 )
 
 set(SHADER_CREATE_INFOS_CONTENT "")
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl
index 5a36b414229..56da7a7ff74 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl
@@ -1,4 +1,3 @@
-
 uniform vec4 color;
 uniform float scale;
 
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl
index ab9c30505c2..d9a5aeeef46 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl
@@ -3,11 +3,13 @@
  * does not need any vertex input (producing less call to immBegin/End)
  */
 
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 uniform vec4 rect_icon;
 uniform vec4 rect_geom;
 
 out vec2 texCoord_interp;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
index 43f259671fa..af9a24d1280 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
@@ -6,6 +6,8 @@
  * Dashed is performed in screen space.
  */
 
+#ifndef USE_GPU_SHADER_CREATE_INFO
+
 uniform float dash_width;
 
 /* Simple mode, discarding non-dash parts (so no need for blending at all). */
@@ -23,6 +25,7 @@ noperspective in vec2 stipple_pos;
 flat in vec2 stipple_start;
 
 out vec4 fragColor;
+#endif
 
 void main()
 {
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
index 15362d020e4..9d52820188b 100644
--- 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
@@ -5,7 +5,7 @@
  *
  * Dashed is performed in screen space.
  */
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 
 uniform vec4 color;
@@ -18,6 +18,7 @@ flat out vec4 color_vert;
 /* We leverage hardware interpolation to compute distance along the line. */
 noperspective out vec2 stipple_pos; /* In screen space */
 flat out vec2 stipple_start;        /* In screen space */
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
index aefa47275f5..9328e0a13e9 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
@@ -6,11 +6,13 @@
  * Dashed is performed in screen space.
  */
 
+#ifndef USE_GPU_SHADER_CREATE_INFO
+
 uniform mat4 ModelViewProjectionMatrix;
 
-#ifdef USE_WORLD_CLIP_PLANES
+#  ifdef USE_WORLD_CLIP_PLANES
 uniform mat4 ModelMatrix;
-#endif
+#  endif
 
 uniform vec4 color;
 uniform vec2 viewport_size;
@@ -22,6 +24,7 @@ flat out vec4 color_vert;
 /* We leverage hardware interpolation to compute distance along the line. */
 noperspective out vec2 stipple_pos; /* In screen space */
 flat out vec2 stipple_start;        /* In screen space */
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl b/source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl
index 3ea8f7dbfbe..8687763f4c1 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl
@@ -1,14 +1,15 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform float lineWidth;
 uniform bool lineSmooth = true;
 
 in vec4 finalColor;
 noperspective in float smoothline;
-#ifdef CLIP
+#  ifdef CLIP
 in float clip;
-#endif
+#  endif
 
 out vec4 fragColor;
+#endif
 
 #define SMOOTH_WIDTH 1.0
 
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl
index 28aa2a4ccc6..5c673494870 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl
@@ -1,18 +1,19 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 uniform mat4 ModelMatrix;
 uniform vec4 ClipPlane;
 
 in vec3 pos;
 
-#if !defined(UNIFORM)
+#  if !defined(UNIFORM)
 in vec4 color;
 
 out vec4 finalColor_g;
-#endif
+#  endif
 
-#ifdef CLIP
+#  ifdef CLIP
 out float clip_g;
+#  endif
 #endif
 
 void main()
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl
index 3a2d96c9929..de555cc5706 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl
@@ -1,6 +1,7 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 in vec4 finalColor;
 out vec4 fragColor;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
index 4eafb7b7be3..5fbfff7dcd6 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
@@ -1,14 +1,15 @@
-
+#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;
 in vec4 color;
 
 out vec4 finalColor;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
index 70bb881ffea..7bcc3110950 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
@@ -1,11 +1,13 @@
 
+#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;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_point_uniform_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_point_uniform_color_frag.glsl
index 692320bea93..aeca823dd8b 100644
--- a/source/blender/gpu/shaders/gpu_shader_point_uniform_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_point_uniform_color_frag.glsl
@@ -1,7 +1,8 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform vec4 color;
 
 out vec4 fragColor;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/infos/gpu_interface_info.hh b/source/blender/gpu/shaders/infos/gpu_interface_info.hh
index f57234fdd4d..61d8e1b9c24 100644
--- a/source/blender/gpu/shaders/infos/gpu_interface_info.hh
+++ b/source/blender/gpu/shaders/infos/gpu_interface_info.hh
@@ -3,4 +3,5 @@
 #include "gpu_shader_create_info.hh"
 
 GPU_SHADER_INTERFACE_INFO(flat_color_iface, "").flat(Type::VEC4, "finalColor");
+GPU_SHADER_INTERFACE_INFO(smooth_color_iface, "").smooth(Type::VEC4, "finalColor");
 GPU_SHADER_INTERFACE_INFO(smooth_tex_coord_interp_iface, "").smooth(Type::VEC2, "texCoord_interp");
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh
new file mode 100644
index 00000000000..0a84395ae11
--- /dev/null
+++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh
@@ -0,0 +1,17 @@
+#include "gpu_interface_info.hh"
+#include "gpu_shader_create_info.hh"
+
+GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color)
+    .vertex_in(0, Type::VEC2, "pos")
+    .vertex_in(1, Type::VEC2, "texCoord")
+    .vertex_out(smooth_tex_coord_interp_iface)
+    .fragment_out(0, Type::VEC4, "fragColor")
+    .push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
+    .push_constant(16, Type::VEC4, "color")
+    .push_constant(20, Type::VEC4, "rect_icon")
+    .push_constant(24, Type::VEC4, "rect_geom")
+    .sampler(0, ImageType::FLOAT_2D, "image")
+    .vertex_source("gpu_shader_2D_image_rect_vert.glsl")
+    .fragment_source("gpu_shader_image_color_frag.glsl")
+    .do_static_compilation(true);
+
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh
new file mode 100644
index 00000000000..9efa8842c55
--- /dev/null
+++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh
@@ -0,0 +1,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list