summaryrefslogtreecommitdiff
path: root/shaders/ui.frag.glsl
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-14 13:55:41 -0300
committerGabriel Schneider <[email protected]>2026-09-15 17:24:42 -0300
commit95681ff7017b8a9e4c8f9fa6a7371d1233432f2f (patch)
tree34787d6bb62944cc778624685387db7376ccf71b /shaders/ui.frag.glsl
parent682e237df7e8b22f820d14a4adee58e6e2f84268 (diff)
downloadpardes-95681ff7017b8a9e4c8f9fa6a7371d1233432f2f.tar.gz
pardes-95681ff7017b8a9e4c8f9fa6a7371d1233432f2f.zip
9p: use cloud9 protocol sessions and transports
Diffstat (limited to 'shaders/ui.frag.glsl')
-rw-r--r--shaders/ui.frag.glsl25
1 files changed, 16 insertions, 9 deletions
diff --git a/shaders/ui.frag.glsl b/shaders/ui.frag.glsl
index 69cb63b9..3c366602 100644
--- a/shaders/ui.frag.glsl
+++ b/shaders/ui.frag.glsl
@@ -1,12 +1,16 @@
#version 450
// Sample the glyph atlas (R = coverage 0..1) and mix the cell's bg up to its fg
-// by that coverage. Output is PREMULTIPLIED: an opaque cell is unchanged, and a
-// cell whose background is the see-through ground (config.gui_transparent, a
-// theme with no bg of its own) contributes only its ink, at the ink's own
-// coverage, so the compositor keeps the rest.
+// by that coverage. Output is PREMULTIPLIED: an opaque cell is unchanged.
+// WindowOpacity changes only the ground's coverage, never the glyph's ink.
+// A cell whose background is the see-through ground (config.gui_transparent,
+// a theme with no bg of its own) still contributes only its ink, at the ink's
+// own coverage, so the compositor keeps the rest.
layout(set = 2, binding = 0) uniform sampler2D u_atlas;
+layout(std140, set = 3, binding = 0) uniform UiUniforms {
+ float background_opacity;
+} u_ui;
layout(location = 0) in vec2 v_uv;
layout(location = 1) in vec3 v_fg;
@@ -29,11 +33,14 @@ float cellNoise(uint serial, uint col, uint row) {
void main() {
float a = texture(u_atlas, v_uv).r;
bool oldLayer = (v_effect.x & 0x80000000u) != 0u;
- // 0 where the cell's background IS the ground and the ground is nothing.
- // src/gui/gui.zig sets that bit; the two flags above it are why the effect
- // id is masked with 0x3fffffff here and in ui.vert.glsl.
- float bgA = (v_effect.x & 0x40000000u) != 0u ? 0.0 : 1.0;
- uint effect = v_effect.x & 0x3fffffffu;
+ // A block cursor is foreground chrome even though its fill occupies the
+ // cell background: keep it visible at WindowOpacity 0. Otherwise a clear
+ // theme ground has no coverage and ordinary backgrounds use the setting.
+ // The three high flags are shared with ui.vert.glsl and src/gui/gui.zig.
+ float bgA = (v_effect.x & 0x20000000u) != 0u ? 1.0
+ : (v_effect.x & 0x40000000u) != 0u ? 0.0
+ : clamp(u_ui.background_opacity, 0.0, 1.0);
+ uint effect = v_effect.x & 0x1fffffffu;
float progress = clamp(uintBitsToFloat(v_effect.y), 0.0, 1.0);
uint cellCol = v_effect.w & 0xffffu;
uint cellRow = v_effect.w >> 16;