ngl: Identify shaders

Add a comment with a name to each shader. That makes
identifying the shaders in apitrace much easier.
This commit is contained in:
Matthias Clasen 2021-03-12 14:25:05 -05:00
parent 0ee6868b7f
commit ebe30d851b
16 changed files with 57 additions and 1 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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() {

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;