summaryrefslogtreecommitdiff
path: root/shaders/prebuilt
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/prebuilt')
-rw-r--r--shaders/prebuilt/bloom-down.frag.spvbin0 -> 3876 bytes
-rw-r--r--shaders/prebuilt/bloom-up.frag.spvbin0 -> 3504 bytes
-rw-r--r--shaders/prebuilt/crt.frag.glsl175
-rw-r--r--shaders/prebuilt/crt.frag.spvbin13832 -> 0 bytes
-rw-r--r--shaders/prebuilt/crt.vert.glsl9
-rw-r--r--shaders/prebuilt/decor.frag.spvbin0 -> 7852 bytes
-rw-r--r--shaders/prebuilt/image.frag.glsl45
-rw-r--r--shaders/prebuilt/image.vert.glsl49
-rw-r--r--shaders/prebuilt/overlay.frag.glsl17
-rw-r--r--shaders/prebuilt/overlay.vert.glsl11
-rw-r--r--shaders/prebuilt/post-bloom.frag.spvbin0 -> 8500 bytes
-rw-r--r--shaders/prebuilt/post-crt.frag.spvbin0 -> 13092 bytes
-rw-r--r--shaders/prebuilt/post-grain.frag.spvbin0 -> 8236 bytes
-rw-r--r--shaders/prebuilt/post-vignette.frag.spvbin0 -> 8652 bytes
-rw-r--r--shaders/prebuilt/post.vert.spv (renamed from shaders/prebuilt/crt.vert.spv)bin1208 -> 1208 bytes
-rw-r--r--shaders/prebuilt/ui.frag.glsl67
-rw-r--r--shaders/prebuilt/ui.frag.spvbin4668 -> 6968 bytes
-rw-r--r--shaders/prebuilt/ui.vert.glsl74
-rw-r--r--shaders/prebuilt/ui.vert.spvbin5468 -> 5612 bytes
19 files changed, 0 insertions, 447 deletions
diff --git a/shaders/prebuilt/bloom-down.frag.spv b/shaders/prebuilt/bloom-down.frag.spv
new file mode 100644
index 00000000..5ca327fe
--- /dev/null
+++ b/shaders/prebuilt/bloom-down.frag.spv
Binary files differ
diff --git a/shaders/prebuilt/bloom-up.frag.spv b/shaders/prebuilt/bloom-up.frag.spv
new file mode 100644
index 00000000..b2c64b80
--- /dev/null
+++ b/shaders/prebuilt/bloom-up.frag.spv
Binary files differ
diff --git a/shaders/prebuilt/crt.frag.glsl b/shaders/prebuilt/crt.frag.glsl
deleted file mode 100644
index b0b0b93b..00000000
--- a/shaders/prebuilt/crt.frag.glsl
+++ /dev/null
@@ -1,175 +0,0 @@
-#version 450
-
-// The Crt builtin's post-process. Screen point cc shows the scene at
-// uv' = cc*(1 + BARREL*r2), and src/gui/crt.zig maps mouse input through that
-// same transform — keep them equal or clicks drift near the edges.
-
-layout(set = 2, binding = 0) uniform sampler2D u_scene;
-layout(std140, set = 3, binding = 0) uniform CrtUniforms {
- float time_seconds;
- float frame;
- vec2 viewport;
- // x = CRT, y = ripple, z = glitch. One scene pass can combine them.
- vec4 effects;
-} u_crt;
-
-layout(location = 0) out vec4 o_col;
-
-const float TAU = 6.28318530718;
-const float BARREL = 0.016; // MUST match src/gui/crt.zig barrel
-const float EDGE_SOFTNESS_PX = 3.5;
-const float CHROMA_PX = 0.28; // radial R/B separation in physical pixels at r2=1
-const float BLOOM_RADIUS_PX = 1.75;
-const float BLOOM_THRESHOLD = 0.60; // linear-light channel peak
-const float BLOOM_SOFTNESS = 0.25;
-const float BLOOM_STRENGTH = 0.045;
-const float SCAN_PERIOD_PX = 3.0;
-const float SCAN_STRENGTH = 0.055;
-const float MASK_PERIOD_PX = 3.0;
-const float MASK_STRENGTH = 0.015;
-const float VIGNETTE_STRENGTH = 0.11; // 11% only at the extreme corners
-const float HUM_STRENGTH = 0.0025;
-const float NOISE_STRENGTH = 0.0020;
-const float EXPOSURE = 1.012;
-
-vec3 srgbToLinear(vec3 c) {
- vec3 low = c / 12.92;
- vec3 high = pow((c + 0.055) / 1.055, vec3(2.4));
- return mix(high, low, lessThanEqual(c, vec3(0.04045)));
-}
-
-vec3 linearToSrgb(vec3 c) {
- c = max(c, vec3(0.0));
- vec3 low = c * 12.92;
- vec3 high = 1.055 * pow(c, vec3(1.0 / 2.4)) - 0.055;
- return mix(high, low, lessThanEqual(c, vec3(0.0031308)));
-}
-
-vec3 sceneLinear(vec2 uv) {
- return srgbToLinear(texture(u_scene, uv).rgb);
-}
-
-vec3 brightPass(vec2 uv) {
- vec3 c = sceneLinear(uv);
- float peak = max(c.r, max(c.g, c.b));
- return c * smoothstep(BLOOM_THRESHOLD, BLOOM_THRESHOLD + BLOOM_SOFTNESS, peak);
-}
-
-float noiseAt(vec2 p) {
- vec3 q = fract(vec3(p.xyx) * 0.1031);
- q += dot(q, q.yzx + 33.33);
- return fract((q.x + q.y) * q.z);
-}
-
-// The non-CRT scene effects deliberately distort the source coordinates,
-// rather than remapping the final colors. Themes retain their palette and the
-// effects remain composable with the linear-light CRT treatment below.
-vec2 sceneUv(vec2 uv) {
- if (u_crt.effects.y > 0.5) {
- vec2 centered = uv - 0.5;
- float radius = length(centered);
- float envelope = 1.0 - smoothstep(0.04, 0.72, radius);
- float wave = sin(radius * 42.0 - u_crt.time_seconds * 5.2);
- uv += centered / max(radius, 0.00001) * wave * envelope * 0.0032;
- }
- if (u_crt.effects.z > 0.5) {
- float band = floor(uv.y * 96.0);
- float seed = noiseAt(vec2(band, floor(u_crt.time_seconds * 13.0)));
- float tear = smoothstep(0.955, 1.0, seed);
- uv.x += (noiseAt(vec2(seed, band)) - 0.5) * tear * 0.020;
- }
- return uv;
-}
-
-// The scene, ALPHA INCLUDED: with a see-through ground the grid arrives
-// premultiplied and partly empty, and a pass that dropped .a would turn the
-// desktop behind a `*_transparent` theme into opaque black the moment Crt,
-// Ripple or Glitch came on.
-vec4 sceneSrgb(vec2 uv) {
- vec2 warped = sceneUv(uv);
- vec4 center = texture(u_scene, warped);
- if (u_crt.effects.z <= 0.5) return center;
-
- float band = floor(warped.y * 96.0);
- float seed = noiseAt(vec2(band, floor(u_crt.time_seconds * 13.0)));
- float tear = smoothstep(0.955, 1.0, seed);
- vec2 chroma = vec2((0.35 + 1.25 * tear) / u_crt.viewport.x, 0.0);
- return vec4(
- texture(u_scene, warped + chroma).r,
- center.g,
- texture(u_scene, warped - chroma).b,
- center.a
- );
-}
-
-vec3 effectSceneLinear(vec2 uv) {
- return srgbToLinear(sceneSrgb(uv).rgb);
-}
-
-void main() {
- vec2 size = u_crt.viewport;
- vec2 texel = 1.0 / size;
- vec2 cc = gl_FragCoord.xy / size * 2.0 - 1.0;
- float r2 = dot(cc, cc);
- vec2 uv = cc * (1.0 + BARREL * r2 * u_crt.effects.x) * 0.5 + 0.5;
-
- // Ripple and glitch are useful without the CRT. They only move samples;
- // skip every tube-specific light/mask/exposure adjustment.
- if (u_crt.effects.x <= 0.5) {
- // The scene texture is already sRGB. Avoid a needless transfer-curve
- // round trip so a coordinate-only effect preserves theme bytes.
- vec4 s = sceneSrgb(uv);
- o_col = vec4(clamp(s.rgb, 0.0, 1.0), clamp(s.a, 0.0, 1.0));
- return;
- }
-
- vec3 col = vec3(0.0);
- // Outside the tube nothing is drawn, so nothing is covered either: the
- // old opaque black there would have punched a rectangle out of the
- // compositor's backdrop.
- float alpha = 0.0;
- float edge = min(min(uv.x, uv.y), min(1.0 - uv.x, 1.0 - uv.y));
- if (edge > 0.0) {
- vec3 center = effectSceneLinear(uv);
- vec2 chroma = cc * (CHROMA_PX * r2) * texel;
- // Each radial sample follows the same ripple/glitch path from its own
- // pre-warp coordinate. This is also how the Metal kernel composes the
- // effects; sampling a once-warped center here made combined effects
- // diverge between the two GUI backends.
- col = vec3(
- effectSceneLinear(uv + chroma).r,
- center.g,
- effectSceneLinear(uv - chroma).b
- );
-
- vec2 bloom_px = texel * BLOOM_RADIUS_PX;
- vec3 bloom = brightPass(uv + vec2(bloom_px.x, 0.0)) +
- brightPass(uv - vec2(bloom_px.x, 0.0)) +
- brightPass(uv + vec2(0.0, bloom_px.y)) +
- brightPass(uv - vec2(0.0, bloom_px.y));
- col += bloom * (0.25 * BLOOM_STRENGTH);
-
- // The mask has unit mean and the scan loss stays small; neither needs
- // the old global lift that remapped every theme toward white.
- float scan_wave = 0.5 + 0.5 * cos(gl_FragCoord.y * TAU / SCAN_PERIOD_PX);
- col *= 1.0 - SCAN_STRENGTH * scan_wave * scan_wave;
- vec3 mask = 1.0 + MASK_STRENGTH * cos(
- gl_FragCoord.x * TAU / MASK_PERIOD_PX + vec3(0.0, TAU / 3.0, 2.0 * TAU / 3.0)
- );
- col *= mask;
-
- vec2 edge_px = min(uv, 1.0 - uv) * size;
- float tube = smoothstep(0.0, EDGE_SOFTNESS_PX, min(edge_px.x, edge_px.y));
- float vignette = 1.0 - VIGNETTE_STRENGTH * pow(clamp(r2 * 0.5, 0.0, 1.0), 1.6);
- float hum = 1.0 + HUM_STRENGTH * sin((uv.y * 1.35 - u_crt.time_seconds * 0.11) * TAU);
- col *= tube * vignette * hum * EXPOSURE;
- // The tube's edge falloff dims coverage as well as colour; everything
- // else here is a light adjustment and leaves it alone.
- alpha = sceneSrgb(uv).a * tube;
-
- float luma = dot(col, vec3(0.2126, 0.7152, 0.0722));
- vec2 noise_seed = gl_FragCoord.xy + vec2(u_crt.frame * 17.0, u_crt.frame * 59.0);
- col += (noiseAt(noise_seed) - 0.5) * NOISE_STRENGTH * (0.15 + 0.85 * clamp(luma, 0.0, 1.0));
- }
- o_col = vec4(linearToSrgb(clamp(col, 0.0, 1.0)), clamp(alpha, 0.0, 1.0));
-}
diff --git a/shaders/prebuilt/crt.frag.spv b/shaders/prebuilt/crt.frag.spv
deleted file mode 100644
index f0e14627..00000000
--- a/shaders/prebuilt/crt.frag.spv
+++ /dev/null
Binary files differ
diff --git a/shaders/prebuilt/crt.vert.glsl b/shaders/prebuilt/crt.vert.glsl
deleted file mode 100644
index 4e15fcdf..00000000
--- a/shaders/prebuilt/crt.vert.glsl
+++ /dev/null
@@ -1,9 +0,0 @@
-#version 450
-
-// CRT post-process pass: one fullscreen triangle from gl_VertexIndex, no
-// vertex buffer. The fragment shader derives uv from gl_FragCoord.
-
-void main() {
- vec2 p = vec2(float((gl_VertexIndex << 1) & 2), float(gl_VertexIndex & 2));
- gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
-}
diff --git a/shaders/prebuilt/decor.frag.spv b/shaders/prebuilt/decor.frag.spv
new file mode 100644
index 00000000..bd565d03
--- /dev/null
+++ b/shaders/prebuilt/decor.frag.spv
Binary files differ
diff --git a/shaders/prebuilt/image.frag.glsl b/shaders/prebuilt/image.frag.glsl
deleted file mode 100644
index 0cc1b2ee..00000000
--- a/shaders/prebuilt/image.frag.glsl
+++ /dev/null
@@ -1,45 +0,0 @@
-#version 450
-
-layout(set = 2, binding = 0) uniform sampler2D u_image;
-layout(std140, set = 3, binding = 0) uniform UiUniforms {
- float background_opacity;
-} u_ui;
-
-layout(location = 0) in vec2 v_uv;
-layout(location = 1) in vec2 v_panel_uv;
-layout(location = 2) flat in uvec4 v_effect;
-layout(location = 0) out vec4 o_col;
-
-float cellNoise(uint serial, uint col, uint row) {
- uint x = serial ^ (col * 0x9e3779b9u) ^ (row * 0x85ebca6bu);
- x ^= x >> 16;
- x *= 0x7feb352du;
- x ^= x >> 15;
- x *= 0x846ca68bu;
- x ^= x >> 16;
- return float(x & 0xffffu) / 65535.0;
-}
-
-void main() {
- vec4 source = texture(u_image, v_uv);
- // Keep source coverage for destination subtraction; the pipeline scales
- // source alpha by the same opacity through its alpha blend constant.
- source.rgb *= clamp(u_ui.background_opacity, 0.0, 1.0);
- uint effect = v_effect.x & 0x7fffffffu;
- bool oldLayer = (v_effect.x & 0x80000000u) != 0u;
- float progress = clamp(uintBitsToFloat(v_effect.y), 0.0, 1.0);
- uvec2 dimensions = max(
- uvec2(v_effect.w & 0xffffu, v_effect.w >> 16),
- uvec2(1u));
- uvec2 cellCoord = min(
- uvec2(floor(max(v_panel_uv, vec2(0.0)) * vec2(dimensions))),
- dimensions - 1u);
- float noise = cellNoise(v_effect.z, cellCoord.x, cellCoord.y);
- if (effect == 3u) {
- bool reveal = progress >= 1.0 || (progress > 0.0 && noise < progress);
- if (oldLayer == reveal) discard;
- o_col = source;
- return;
- }
- o_col = source;
-}
diff --git a/shaders/prebuilt/image.vert.glsl b/shaders/prebuilt/image.vert.glsl
deleted file mode 100644
index 04196ce4..00000000
--- a/shaders/prebuilt/image.vert.glsl
+++ /dev/null
@@ -1,49 +0,0 @@
-#version 450
-
-// One instance per Surface image attachment. The CPU has already converted
-// the pane's cell rectangle and the aspect-preserving contain fit to NDC.
-layout(location = 0) in vec4 a_rect; // x0, y0, x1, y1
-layout(location = 1) in vec4 a_uv_rect; // u0, v0, u1, v1
-layout(location = 2) in vec4 a_panel_rect;
-layout(location = 3) in vec4 a_present_rect;
-layout(location = 4) in uvec4 a_effect;
-
-layout(location = 0) out vec2 v_uv;
-layout(location = 1) out vec2 v_panel_uv;
-layout(location = 2) flat out uvec4 v_effect;
-
-void main() {
- vec2 pos;
- int corner = gl_VertexIndex % 6;
- if (corner == 0) {
- pos = vec2(a_rect.x, a_rect.y);
- v_uv = vec2(a_uv_rect.x, a_uv_rect.y);
- } else if (corner == 1) {
- pos = vec2(a_rect.z, a_rect.y);
- v_uv = vec2(a_uv_rect.z, a_uv_rect.y);
- } else if (corner == 2) {
- pos = vec2(a_rect.z, a_rect.w);
- v_uv = vec2(a_uv_rect.z, a_uv_rect.w);
- } else if (corner == 3) {
- pos = vec2(a_rect.x, a_rect.y);
- v_uv = vec2(a_uv_rect.x, a_uv_rect.y);
- } else if (corner == 4) {
- pos = vec2(a_rect.z, a_rect.w);
- v_uv = vec2(a_uv_rect.z, a_uv_rect.w);
- } else {
- pos = vec2(a_rect.x, a_rect.w);
- v_uv = vec2(a_uv_rect.x, a_uv_rect.w);
- }
- v_panel_uv = v_uv;
- uint effect = a_effect.x & 0x7fffffffu;
- if (effect != 0u) {
- vec2 panel_size = a_panel_rect.zw - a_panel_rect.xy;
- panel_size.x = abs(panel_size.x) < 0.000001 ? 0.000001 : panel_size.x;
- panel_size.y = abs(panel_size.y) < 0.000001 ? -0.000001 : panel_size.y;
- v_panel_uv = (pos - a_panel_rect.xy) / panel_size;
- if (effect == 1u || effect == 2u || effect == 5u)
- pos = mix(a_present_rect.xy, a_present_rect.zw, v_panel_uv);
- }
- v_effect = a_effect;
- gl_Position = vec4(pos, 0.0, 1.0);
-}
diff --git a/shaders/prebuilt/overlay.frag.glsl b/shaders/prebuilt/overlay.frag.glsl
deleted file mode 100644
index b5ac8d5a..00000000
--- a/shaders/prebuilt/overlay.frag.glsl
+++ /dev/null
@@ -1,17 +0,0 @@
-#version 450
-
-layout(std140, set = 3, binding = 0) uniform UiUniforms {
- float background_opacity;
-} u_ui;
-
-layout(location = 0) in vec4 v_color;
-
-layout(location = 0) out vec4 o_col;
-
-void main() {
- // Preserve shape coverage for destination subtraction. The pipeline uses
- // the matching opacity blend constant for source alpha, so graphics laid
- // over a background with the same opacity do not accumulate opaque seams.
- // Text/cursor draw groups bind opacity 1 instead.
- o_col = vec4(v_color.rgb * clamp(u_ui.background_opacity, 0.0, 1.0), v_color.a);
-}
diff --git a/shaders/prebuilt/overlay.vert.glsl b/shaders/prebuilt/overlay.vert.glsl
deleted file mode 100644
index 5f6be593..00000000
--- a/shaders/prebuilt/overlay.vert.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-#version 450
-
-layout(location = 0) in vec2 a_pos;
-layout(location = 1) in vec4 a_color;
-
-layout(location = 0) out vec4 v_color;
-
-void main() {
- v_color = a_color;
- gl_Position = vec4(a_pos, 0.0, 1.0);
-}
diff --git a/shaders/prebuilt/post-bloom.frag.spv b/shaders/prebuilt/post-bloom.frag.spv
new file mode 100644
index 00000000..7b71dbdd
--- /dev/null
+++ b/shaders/prebuilt/post-bloom.frag.spv
Binary files differ
diff --git a/shaders/prebuilt/post-crt.frag.spv b/shaders/prebuilt/post-crt.frag.spv
new file mode 100644
index 00000000..fe2c3edb
--- /dev/null
+++ b/shaders/prebuilt/post-crt.frag.spv
Binary files differ
diff --git a/shaders/prebuilt/post-grain.frag.spv b/shaders/prebuilt/post-grain.frag.spv
new file mode 100644
index 00000000..e4c893af
--- /dev/null
+++ b/shaders/prebuilt/post-grain.frag.spv
Binary files differ
diff --git a/shaders/prebuilt/post-vignette.frag.spv b/shaders/prebuilt/post-vignette.frag.spv
new file mode 100644
index 00000000..4dfb6125
--- /dev/null
+++ b/shaders/prebuilt/post-vignette.frag.spv
Binary files differ
diff --git a/shaders/prebuilt/crt.vert.spv b/shaders/prebuilt/post.vert.spv
index 8a75ebb3..8a75ebb3 100644
--- a/shaders/prebuilt/crt.vert.spv
+++ b/shaders/prebuilt/post.vert.spv
Binary files differ
diff --git a/shaders/prebuilt/ui.frag.glsl b/shaders/prebuilt/ui.frag.glsl
deleted file mode 100644
index 3c366602..00000000
--- a/shaders/prebuilt/ui.frag.glsl
+++ /dev/null
@@ -1,67 +0,0 @@
-#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.
-// 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;
-layout(location = 2) in vec3 v_bg;
-layout(location = 3) in vec2 v_cell_uv;
-layout(location = 4) flat in uvec4 v_effect;
-
-layout(location = 0) out vec4 o_col;
-
-float cellNoise(uint serial, uint col, uint row) {
- uint x = serial ^ (col * 0x9e3779b9u) ^ (row * 0x85ebca6bu);
- x ^= x >> 16;
- x *= 0x7feb352du;
- x ^= x >> 15;
- x *= 0x846ca68bu;
- x ^= x >> 16;
- return float(x & 0xffffu) / 65535.0;
-}
-
-void main() {
- float a = texture(u_atlas, v_uv).r;
- bool oldLayer = (v_effect.x & 0x80000000u) != 0u;
- // 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;
- float noise = cellNoise(v_effect.z, cellCol, cellRow);
-
- // Ink over ground, both premultiplied: v_fg*a + (v_bg*bgA)*(1-a), which is
- // mix() with the ground already premultiplied. At bgA = 1 that is exactly
- // the mix(v_bg, v_fg, a) at alpha 1 this shader always wrote.
- vec4 cell = vec4(mix(v_bg * bgA, v_fg, a), mix(bgA, 1.0, a));
-
- // 3 = data dissolve. Changed cells retain the frozen old cell until their
- // stable threshold, then atomically become the new cell. Exact endpoints
- // mirror panel_animation.dissolveRevealed, including the zero hash.
- if (effect == 3u) {
- bool reveal = progress >= 1.0 || (progress > 0.0 && noise < progress);
- if (oldLayer ? reveal : !reveal) discard;
- o_col = cell;
- return;
- }
-
- // FreeType's hinted grayscale bitmap is already the intended coverage.
- // Preserve it exactly; weight-changing gamma hacks blur small stems.
- o_col = cell;
-}
diff --git a/shaders/prebuilt/ui.frag.spv b/shaders/prebuilt/ui.frag.spv
index 120438e7..02e3edc4 100644
--- a/shaders/prebuilt/ui.frag.spv
+++ b/shaders/prebuilt/ui.frag.spv
Binary files differ
diff --git a/shaders/prebuilt/ui.vert.glsl b/shaders/prebuilt/ui.vert.glsl
deleted file mode 100644
index d23b609c..00000000
--- a/shaders/prebuilt/ui.vert.glsl
+++ /dev/null
@@ -1,74 +0,0 @@
-#version 450
-
-// Terminal cell renderer. The CPU uploads one instance per visible cell; this
-// shader expands each instance into a two-triangle quad with gl_VertexIndex.
-// The fragment shader mixes fg/bg by the atlas's alpha (a glyph mask in the R
-// channel), so background fills and glyph foregrounds draw in a single pass.
-
-layout(location = 0) in vec4 a_rect; // x0, y0, x1, y1
-layout(location = 1) in vec4 a_uv_rect; // u0, v0, u1, v1
-layout(location = 2) in vec3 a_fg;
-layout(location = 3) in vec3 a_bg;
-// Final and presented panel rectangles in NDC. The CPU still uploads logical
-// final cells; this shader is the only place transition geometry is applied.
-layout(location = 4) in vec4 a_panel_rect;
-layout(location = 5) in vec4 a_present_rect;
-// effect id, eased-progress float bits, pane serial, local row/column packed
-// into one uint. The THREE high effect bits are flags — the frozen-old cell
-// layer, a see-through cell background and an opaque block-cursor fill — so
-// the id is what is left below them; integer transport preserves the exact
-// cross-backend hash.
-layout(location = 6) in uvec4 a_effect;
-
-layout(location = 0) out vec2 v_uv;
-layout(location = 1) out vec3 v_fg;
-layout(location = 2) out vec3 v_bg;
-layout(location = 3) out vec2 v_cell_uv;
-layout(location = 4) flat out uvec4 v_effect;
-
-void main() {
- vec2 pos;
- vec2 uv;
- int corner = gl_VertexIndex % 6;
- if (corner == 0) {
- pos = vec2(a_rect.x, a_rect.y);
- uv = vec2(a_uv_rect.x, a_uv_rect.y);
- v_cell_uv = vec2(0.0, 0.0);
- } else if (corner == 1) {
- pos = vec2(a_rect.z, a_rect.y);
- uv = vec2(a_uv_rect.z, a_uv_rect.y);
- v_cell_uv = vec2(1.0, 0.0);
- } else if (corner == 2) {
- pos = vec2(a_rect.z, a_rect.w);
- uv = vec2(a_uv_rect.z, a_uv_rect.w);
- v_cell_uv = vec2(1.0, 1.0);
- } else if (corner == 3) {
- pos = vec2(a_rect.x, a_rect.y);
- uv = vec2(a_uv_rect.x, a_uv_rect.y);
- v_cell_uv = vec2(0.0, 0.0);
- } else if (corner == 4) {
- pos = vec2(a_rect.z, a_rect.w);
- uv = vec2(a_uv_rect.z, a_uv_rect.w);
- v_cell_uv = vec2(1.0, 1.0);
- } else {
- pos = vec2(a_rect.x, a_rect.w);
- uv = vec2(a_uv_rect.x, a_uv_rect.w);
- v_cell_uv = vec2(0.0, 1.0);
- }
-
- uint effect = a_effect.x & 0x1fffffffu;
- if (effect == 1u || effect == 2u || effect == 5u) {
- // NDC y points up, so a top-left/bottom-right box has a NEGATIVE y
- // delta. Preserve that sign or every local y is mirrored/outside.
- vec2 panel_size = a_panel_rect.zw - a_panel_rect.xy;
- panel_size.x = abs(panel_size.x) < 0.000001 ? 0.000001 : panel_size.x;
- panel_size.y = abs(panel_size.y) < 0.000001 ? -0.000001 : panel_size.y;
- vec2 within = (pos - a_panel_rect.xy) / panel_size;
- pos = mix(a_present_rect.xy, a_present_rect.zw, within);
- }
- v_uv = uv;
- v_fg = a_fg;
- v_bg = a_bg;
- v_effect = a_effect;
- gl_Position = vec4(pos, 0.0, 1.0);
-}
diff --git a/shaders/prebuilt/ui.vert.spv b/shaders/prebuilt/ui.vert.spv
index 659049dd..af5b0738 100644
--- a/shaders/prebuilt/ui.vert.spv
+++ b/shaders/prebuilt/ui.vert.spv
Binary files differ