[Bf-blender-cvs] [a54cc2acd2f] tmp-gpu-shader-descriptor-2: Added #ifndefs in all builtin shaders.

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


Commit: a54cc2acd2f43d91cc1dbbaf1fbdc5397d235760
Author: Jeroen Bakker
Date:   Fri Jan 7 14:29:35 2022 +0100
Branches: tmp-gpu-shader-descriptor-2
https://developer.blender.org/rBa54cc2acd2f43d91cc1dbbaf1fbdc5397d235760

Added #ifndefs in all builtin shaders.

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

M	source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_image_multi_rect_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_aa_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_point_varying_size_varying_color_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_clipped_uniform_color_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_normal_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_point_fixed_size_varying_color_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_aa_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_varying_color_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_3D_polyline_geom.glsl
M	source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl
M	source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl
M	source/blender/gpu/shaders/gpu_shader_common_obinfos_lib.glsl
M	source/blender/gpu/shaders/gpu_shader_flat_color_alpha_test_0_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_flat_id_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_geometry.glsl
M	source/blender/gpu/shaders/gpu_shader_gpencil_stroke_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl
M	source/blender/gpu/shaders/gpu_shader_gpencil_stroke_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_image_varying_color_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_point_uniform_color_aa_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_point_uniform_color_outline_aa_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_point_varying_color_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_point_varying_color_outline_aa_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_point_varying_color_varying_outline_aa_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_simple_lighting_frag.glsl

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

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 56da7a7ff74..4ebcb9c397f 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,9 +1,11 @@
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform vec4 color;
 uniform float scale;
 
 in vec2 uv;
 
 out vec4 fragColor;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl
index d20ddcd27c0..c6f01d68eee 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl
@@ -1,4 +1,4 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 
 uniform vec4 rect;
@@ -8,6 +8,7 @@ uniform float scale;
 in vec2 pos;
 
 out vec2 uv;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl
index 108fc85c4a5..83bff8c781f 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl
@@ -1,17 +1,18 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 
 uniform float dashWidth;
 
-#ifdef SMOOTH_COLOR
+#  ifdef SMOOTH_COLOR
 noperspective in vec4 finalColor;
-#else
+#  else
 flat in vec4 finalColor;
-#endif
+#  endif
 
 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_edituvs_edges_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
index 69fe5c93a61..46ca9ba1282 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
@@ -1,4 +1,4 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 uniform vec4 edgeColor;
 uniform vec4 selectColor;
@@ -6,14 +6,15 @@ uniform vec4 selectColor;
 in vec2 pos;
 in int flag;
 
-#ifdef SMOOTH_COLOR
+#  ifdef SMOOTH_COLOR
 noperspective out vec4 finalColor;
-#else
+#  else
 flat out vec4 finalColor;
-#endif
+#  endif
 
 noperspective out vec2 stipple_pos;
 flat out vec2 stipple_start;
+#endif
 
 /* TODO: Port drawing to draw manager and
  * remove constants duplications. */
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
index 7a94fc088c4..e022ba6df54 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
@@ -1,4 +1,4 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 uniform vec4 vertColor;
 uniform vec4 selectColor;
@@ -7,6 +7,7 @@ in vec2 pos;
 in int flag;
 
 out vec4 finalColor;
+#endif
 
 /* TODO: Port drawing to draw manager and
  * remove constants duplications. */
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
index 6fc41271cf5..c72a65a3df5 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
@@ -1,4 +1,4 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 uniform vec4 faceColor;
 uniform vec4 selectColor;
@@ -8,6 +8,7 @@ in vec2 pos;
 in int flag;
 
 flat out vec4 finalColor;
+#endif
 
 /* TODO: Port drawing to draw manager and
  * remove constants duplications. */
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
index bec565be1df..a036cdcb906 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
@@ -1,4 +1,4 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 uniform vec4 vertColor;
 uniform vec4 selectColor;
@@ -12,6 +12,7 @@ in int flag;
 out vec4 fillColor;
 out vec4 outlineColor;
 out vec4 radii;
+#endif
 
 /* TODO: Port drawing to draw manager and
  * remove constants duplications. */
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl
index 3254a7e1508..3ad9b906e23 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl
@@ -1,21 +1,22 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 uniform vec2 aspect;
 
 in vec2 pos;
 
-#ifdef STRETCH_ANGLE
+#  ifdef STRETCH_ANGLE
 in vec2 uv_angles;
 in float angle;
 
-#else
+#  else
 in float ratio;
 uniform float totalAreaRatio;
 uniform float totalAreaRatioInv;
 
-#endif
+#  endif
 
 noperspective out vec4 finalColor;
+#endif
 
 vec3 weight_to_rgb(float weight)
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_image_multi_rect_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_image_multi_rect_vert.glsl
index bdc0d37a7ae..f4d8a941a6d 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_image_multi_rect_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_image_multi_rect_vert.glsl
@@ -4,7 +4,8 @@
  */
 
 /* Same as ICON_DRAW_CACHE_SIZE */
-#define MAX_CALLS 16
+#ifndef USE_GPU_SHADER_CREATE_INFO
+#  define MAX_CALLS 16
 
 uniform vec4 calls_data[MAX_CALLS * 3];
 
@@ -12,6 +13,7 @@ out vec2 texCoord_interp;
 flat out vec4 finalColor;
 
 in vec2 pos;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
index 134a7d00127..c4d56579b18 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
@@ -1,4 +1,4 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 in float colorGradient;
 in vec4 finalColor;
 in float lineU;
@@ -8,6 +8,7 @@ flat in float dashAlpha;
 flat in int isMainLine;
 
 out vec4 fragColor;
+#endif
 
 #define DASH_WIDTH 10.0
 #define ANTIALIAS 1.0
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
index 8325568988c..ff48d32685b 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
@@ -4,13 +4,15 @@
 
 #define MID_VERTEX 65
 
+#ifndef USE_GPU_SHADER_CREATE_INFO
+
 /* u is position along the curve, defining the tangent space.
  * v is "signed" distance (compressed to [0..1] range) from the pos in expand direction */
 in vec2 uv;
 in vec2 pos; /* verts position in the curve tangent space */
 in vec2 expand;
 
-#ifdef USE_INSTANCE
+#  ifdef USE_INSTANCE
 /* Instance attrs. */
 in vec2 P0;
 in vec2 P1;
@@ -27,20 +29,20 @@ in float dash_alpha;
 
 uniform vec4 colors[6];
 
-#  define colStart (colid_doarrow[0] < 3 ? start_color : colors[colid_doarrow[0]])
-#  define colEnd (colid_doarrow[1] < 3 ? end_color : colors[colid_doarrow[1]])
-#  define colShadow colors[colid_doarrow[2]]
-#  define doArrow (colid_doarrow[3] != 0)
-#  define doMuted (domuted[0] != 0)
+#    define colStart (colid_doarrow[0] < 3 ? start_color : colors[colid_doarrow[0]])
+#    define colEnd (colid_doarrow[1] < 3 ? end_color : colors[colid_doarrow[1]])
+#    define colShadow colors[colid_doarrow[2]]
+#    define doArrow (colid_doarrow[3] != 0)
+#    define doMuted (domuted[0] != 0)
 
-#else
+#  else
 /* Single curve drawcall, use uniform. */
 uniform vec2 bezierPts[4];
 
-#  define P0 bezierPts[0]
-#  define P1 bezierPts[1]
-#  define P2 bezierPts[2]
-#  define P3 bezierPts[3]
+#    define P0 bezierPts[0]
+#    define P1 bezierPts[1]
+#    define P2 bezierPts[2]
+#    define P3 bezierPts[3]
 
 uniform vec4 colors[3];
 uniform bool doArrow;
@@ -50,11 +52,11 @@ uniform float thickness;
 uniform float dash_factor;
 uniform float dash_alpha;
 
-#  define colShadow colors[0]
-#  define colStart colors[1]
-#  define colEnd colors[2]
+#    define colShadow colors[0]
+#    define colStart colors[1]
+#    define colEnd colors[2]
 
-#endif
+#  endif
 
 uniform float expandSize;
 uniform float arrowSize;
@@ -67,6 +69,7 @@ flat out float lineLength;
 flat out float dashFactor;
 flat out float dashAlpha;
 flat out int isMainLine;
+#endif
 
 /* Define where along the noodle the gradient will starts and ends.
  * Use 0.25 instead of 0.35-0.65, because of a visual shift issue. */
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_aa_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_aa_vert.glsl
index 1453393aa9f..f2b6aa1f12c 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_aa_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_aa_vert.glsl
@@ -1,9 +1,11 @@
 
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 uniform float size;
 
 in vec2 pos;
 out vec2 radii;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl
index 5c555b2d3e7..5d97fca1116 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl
@@ -1,10 +1,11 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 uniform float size;
 uniform float outlineWidth;
 
 in vec2 pos;
 out vec4 radii;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert.glsl
index 3eec271913a..5aa2e89a92c 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_point

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list