summaryrefslogtreecommitdiff
path: root/shaders/prebuilt/decor.frag.glsl
blob: 4c2bd6d826f45f1330f437bc4a1b1aaa3e01fe4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
}