summaryrefslogtreecommitdiff
path: root/shaders/decor.frag.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/decor.frag.glsl')
-rw-r--r--shaders/decor.frag.glsl24
1 files changed, 24 insertions, 0 deletions
diff --git a/shaders/decor.frag.glsl b/shaders/decor.frag.glsl
new file mode 100644
index 00000000..4c2bd6d8
--- /dev/null
+++ b/shaders/decor.frag.glsl
@@ -0,0 +1,24 @@
+#version 450
+
+// Decor: a flat, hard-edged fill (a rule, a rail, a grip mark, a bar cursor)
+// that ui.vert.glsl places like a cell, its track's transition included. Its
+// colour rides in the cell's ground (a_bg) and its coverage in a_fg.r. The
+// pipeline blends it as the overlay pipeline does (backgroundLayerBlend), so
+// a fading rule shows through, and the result is that pipeline's exactly.
+// Ink (a cursor) is drawn with the opacity uniform at 1.
+
+layout(std140, set = 3, binding = 0) uniform UiUniforms {
+ float background_opacity;
+} u_ui;
+
+layout(location = 1) in vec3 v_fg;
+layout(location = 2) in vec3 v_bg;
+layout(location = 5) flat in vec4 v_clip;
+
+layout(location = 0) out vec4 o_col;
+
+void main() {
+ if (v_clip.z >= v_clip.x && (gl_FragCoord.x < v_clip.x || gl_FragCoord.x >= v_clip.z ||
+ gl_FragCoord.y < v_clip.y || gl_FragCoord.y >= v_clip.w)) discard;
+ o_col = vec4(v_bg * clamp(u_ui.background_opacity, 0.0, 1.0), v_fg.r);
+}