[gtk/ngl-vertex-attributes] ngl: Identify shaders




commit ebe30d851b1d634a178a7d18e22c0d74124edbc0
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Mar 12 14:25:05 2021 -0500

    ngl: Identify shaders
    
    Add a comment with a name to each shader. That makes
    identifying the shaders in apitrace much easier.

 gsk/ngl/resources/blend.glsl                   | 3 +++
 gsk/ngl/resources/blit.glsl                    | 3 +++
 gsk/ngl/resources/blur.glsl                    | 4 ++++
 gsk/ngl/resources/border.glsl                  | 4 ++++
 gsk/ngl/resources/color.glsl                   | 4 ++++
 gsk/ngl/resources/color_matrix.glsl            | 3 +++
 gsk/ngl/resources/coloring.glsl                | 3 +++
 gsk/ngl/resources/conic_gradient.glsl          | 4 ++++
 gsk/ngl/resources/cross_fade.glsl              | 3 +++
 gsk/ngl/resources/custom.glsl                  | 4 ++++
 gsk/ngl/resources/inset_shadow.glsl            | 4 ++++
 gsk/ngl/resources/linear_gradient.glsl         | 3 +++
 gsk/ngl/resources/outset_shadow.glsl           | 6 +++++-
 gsk/ngl/resources/radial_gradient.glsl         | 4 ++++
 gsk/ngl/resources/repeat.glsl                  | 3 +++
 gsk/ngl/resources/unblurred_outset_shadow.glsl | 3 +++
 16 files changed, 57 insertions(+), 1 deletion(-)
---
diff --git a/gsk/ngl/resources/blend.glsl b/gsk/ngl/resources/blend.glsl
index 51670f8b78..066c20179d 100644
--- a/gsk/ngl/resources/blend.glsl
+++ b/gsk/ngl/resources/blend.glsl
@@ -1,4 +1,5 @@
 // VERTEX_SHADER:
+// blend.glsl
 
 void main() {
   gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
@@ -7,6 +8,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// blend.glsl
+
 uniform int u_mode;
 uniform sampler2D u_source2;
 
diff --git a/gsk/ngl/resources/blit.glsl b/gsk/ngl/resources/blit.glsl
index 93416bc6a4..c232be2bfd 100644
--- a/gsk/ngl/resources/blit.glsl
+++ b/gsk/ngl/resources/blit.glsl
@@ -1,4 +1,5 @@
 // VERTEX_SHADER:
+// blit.glsl
 
 void main() {
   gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
@@ -7,6 +8,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// blit.glsl
+
 void main() {
   vec4 diffuse = GskTexture(u_source, vUv);
 
diff --git a/gsk/ngl/resources/blur.glsl b/gsk/ngl/resources/blur.glsl
index f782ab48cc..7e7c1c2518 100644
--- a/gsk/ngl/resources/blur.glsl
+++ b/gsk/ngl/resources/blur.glsl
@@ -1,4 +1,6 @@
 // VERTEX_SHADER:
+// blur.glsl
+
 uniform float u_blur_radius;
 uniform vec2 u_blur_size;
 uniform vec2 u_blur_dir;
@@ -25,6 +27,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// blur.glsl
+
 _IN_ vec2 pixel_step;
 _IN_ float pixels_per_side;
 _IN_ vec3 initial_gaussian;
diff --git a/gsk/ngl/resources/border.glsl b/gsk/ngl/resources/border.glsl
index 997aeab3da..a9c04556a4 100644
--- a/gsk/ngl/resources/border.glsl
+++ b/gsk/ngl/resources/border.glsl
@@ -1,4 +1,6 @@
 // VERTEX_SHADER:
+// border.glsl
+
 uniform vec4 u_widths;
 uniform vec4[3] u_outline_rect;
 
@@ -22,6 +24,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// border.glsl
+
 uniform vec4[3] u_outline_rect;
 
 _IN_ vec4 final_color;
diff --git a/gsk/ngl/resources/color.glsl b/gsk/ngl/resources/color.glsl
index 5d2370bdf5..670b9979a2 100644
--- a/gsk/ngl/resources/color.glsl
+++ b/gsk/ngl/resources/color.glsl
@@ -1,4 +1,6 @@
 // VERTEX_SHADER:
+// color.glsl
+
 _OUT_ vec4 final_color;
 
 void main() {
@@ -8,6 +10,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// color.glsl
+
 _IN_ vec4 final_color;
 
 void main() {
diff --git a/gsk/ngl/resources/color_matrix.glsl b/gsk/ngl/resources/color_matrix.glsl
index 06e645b605..44dcf9a044 100644
--- a/gsk/ngl/resources/color_matrix.glsl
+++ b/gsk/ngl/resources/color_matrix.glsl
@@ -1,4 +1,5 @@
 // VERTEX_SHADER:
+// color_matrix.glsl
 
 void main() {
   gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
@@ -7,6 +8,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// color_matrix.glsl
+
 uniform mat4 u_color_matrix;
 uniform vec4 u_color_offset;
 
diff --git a/gsk/ngl/resources/coloring.glsl b/gsk/ngl/resources/coloring.glsl
index d7d2aed7d6..69b21c6e2e 100644
--- a/gsk/ngl/resources/coloring.glsl
+++ b/gsk/ngl/resources/coloring.glsl
@@ -1,4 +1,6 @@
 // VERTEX_SHADER:
+// coloring.glsl
+
 _OUT_ vec4 final_color;
 flat _OUT_ int use_color;
 
@@ -19,6 +21,7 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// coloring.glsl
 
 _IN_ vec4 final_color;
 flat _IN_ int use_color;
diff --git a/gsk/ngl/resources/conic_gradient.glsl b/gsk/ngl/resources/conic_gradient.glsl
index 48a1cf7149..afb427bb15 100644
--- a/gsk/ngl/resources/conic_gradient.glsl
+++ b/gsk/ngl/resources/conic_gradient.glsl
@@ -1,4 +1,6 @@
 // VERTEX_SHADER
+// conic_gradient.glsl
+
 uniform vec4 u_geometry;
 
 _NOPERSPECTIVE_ _OUT_ vec2 coord;
@@ -14,6 +16,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// conic_gradient.glsl
+
 #ifdef GSK_LEGACY
 uniform int u_num_color_stops;
 #else
diff --git a/gsk/ngl/resources/cross_fade.glsl b/gsk/ngl/resources/cross_fade.glsl
index dddc44fdd0..e61af597e9 100644
--- a/gsk/ngl/resources/cross_fade.glsl
+++ b/gsk/ngl/resources/cross_fade.glsl
@@ -1,4 +1,5 @@
 // VERTEX_SHADER:
+// cross_fade.glsl
 
 void main() {
   gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
@@ -7,6 +8,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// cross_fade.glsl
+
 uniform float u_progress;
 uniform sampler2D u_source2;
 
diff --git a/gsk/ngl/resources/custom.glsl b/gsk/ngl/resources/custom.glsl
index d2aed97fc8..6f91df6cf4 100644
--- a/gsk/ngl/resources/custom.glsl
+++ b/gsk/ngl/resources/custom.glsl
@@ -1,10 +1,14 @@
 // VERTEX_SHADER:
+// custom.glsl
+
 void main() {
   gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
   vUv = vec2(aUv.x, aUv.y);
 }
 
 // FRAGMENT_SHADER:
+// custom.glsl
+
 // The shader supplies:
 void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv);
 
diff --git a/gsk/ngl/resources/inset_shadow.glsl b/gsk/ngl/resources/inset_shadow.glsl
index aae2f2ebef..1c3c955035 100644
--- a/gsk/ngl/resources/inset_shadow.glsl
+++ b/gsk/ngl/resources/inset_shadow.glsl
@@ -1,4 +1,6 @@
 // VERTEX_SHADER:
+// inset_shadow.glsl
+
 uniform float u_spread;
 uniform vec2 u_offset;
 uniform vec4[3] u_outline_rect;
@@ -25,6 +27,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// inset_shadow.glsl
+
 _IN_ vec4 final_color;
 _IN_ _GSK_ROUNDED_RECT_UNIFORM_ transformed_outside_outline;
 _IN_ _GSK_ROUNDED_RECT_UNIFORM_ transformed_inside_outline;
diff --git a/gsk/ngl/resources/linear_gradient.glsl b/gsk/ngl/resources/linear_gradient.glsl
index cc90392c06..1a2f2675e0 100644
--- a/gsk/ngl/resources/linear_gradient.glsl
+++ b/gsk/ngl/resources/linear_gradient.glsl
@@ -1,4 +1,5 @@
 // VERTEX_SHADER
+// linear_gradient.glsl
 uniform vec4 u_points;
 
 _NOPERSPECTIVE_ _OUT_ vec4 info;
@@ -39,6 +40,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// linear_gradient.glsl
+
 #ifdef GSK_LEGACY
 uniform int u_num_color_stops;
 #else
diff --git a/gsk/ngl/resources/outset_shadow.glsl b/gsk/ngl/resources/outset_shadow.glsl
index e8a802e494..427aee956c 100644
--- a/gsk/ngl/resources/outset_shadow.glsl
+++ b/gsk/ngl/resources/outset_shadow.glsl
@@ -1,4 +1,6 @@
 // VERTEX_SHADER:
+// outset_shadow.glsl
+
 uniform vec4[3] u_outline_rect;
 
 _OUT_ vec4 final_color;
@@ -17,13 +19,15 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// outset_shadow.glsl
+
 _IN_ vec4 final_color;
 _IN_ _GSK_ROUNDED_RECT_UNIFORM_ transformed_outline;
 
 void main() {
   vec2 frag = gsk_get_frag_coord();
-
   float alpha = GskTexture(u_source, vUv).a;
+
   alpha *= (1.0 -  clamp(gsk_rounded_rect_coverage(gsk_decode_rect(transformed_outline), frag), 0.0, 1.0));
 
   vec4 color = final_color * alpha;
diff --git a/gsk/ngl/resources/radial_gradient.glsl b/gsk/ngl/resources/radial_gradient.glsl
index 0ab3fdf07a..e8b57ef635 100644
--- a/gsk/ngl/resources/radial_gradient.glsl
+++ b/gsk/ngl/resources/radial_gradient.glsl
@@ -1,4 +1,6 @@
 // VERTEX_SHADER
+// radial_gradient.glsl
+
 uniform vec4 u_geometry;
 
 _NOPERSPECTIVE_ _OUT_ vec2 coord;
@@ -16,6 +18,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// radial_gradient.glsl
+
 #ifdef GSK_LEGACY
 uniform int u_num_color_stops;
 #else
diff --git a/gsk/ngl/resources/repeat.glsl b/gsk/ngl/resources/repeat.glsl
index 654446c70f..5d39603396 100644
--- a/gsk/ngl/resources/repeat.glsl
+++ b/gsk/ngl/resources/repeat.glsl
@@ -1,4 +1,5 @@
 // VERTEX_SHADER:
+// repeat.glsl
 
 void main() {
   gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
@@ -7,6 +8,8 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// repeat.glsl
+
 uniform vec4 u_child_bounds;
 uniform vec4 u_texture_rect;
 
diff --git a/gsk/ngl/resources/unblurred_outset_shadow.glsl b/gsk/ngl/resources/unblurred_outset_shadow.glsl
index 56f0750e6d..305cc5f1e2 100644
--- a/gsk/ngl/resources/unblurred_outset_shadow.glsl
+++ b/gsk/ngl/resources/unblurred_outset_shadow.glsl
@@ -1,4 +1,6 @@
 // VERTEX_SHADER:
+// unblurred_outset_shadow.glsl
+
 uniform float u_spread;
 uniform vec2 u_offset;
 uniform vec4[3] u_outline_rect;
@@ -25,6 +27,7 @@ void main() {
 }
 
 // FRAGMENT_SHADER:
+// unblurred_outset_shadow.glsl
 _IN_ vec4 final_color;
 _IN_ _GSK_ROUNDED_RECT_UNIFORM_ transformed_outside_outline;
 _IN_ _GSK_ROUNDED_RECT_UNIFORM_ transformed_inside_outline;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]