summaryrefslogtreecommitdiff
path: root/shaders/ui.frag.glsl
blob: d00a060184bddc88b9a5c1f7f91679f6a03a56b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#version 450

// Sample the glyph atlas (R = coverage 0..1) and mix the cell's bg up to its fg
// by that coverage. Fully opaque: the swapchain is SDR, no blending needed.

layout(set = 2, binding = 0) uniform sampler2D u_atlas;

layout(location = 0) in vec2 v_uv;
layout(location = 1) in vec3 v_fg;
layout(location = 2) in vec3 v_bg;

layout(location = 0) out vec4 o_col;

void main() {
    float a = texture(u_atlas, v_uv).r;
    // FreeType's hinted grayscale bitmap is already the intended coverage.
    // Preserve it exactly; weight-changing gamma hacks blur small stems.
    vec3 col = mix(v_bg, v_fg, a);
    o_col = vec4(col, 1.0);
}