From ecdb0996147f319a4427273bf276e1fc5bf89156 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 11:50:43 -0300 Subject: effects out, the panel transitions: the eleven Panel words in both tracks go, with the core's Presentation (tracks, the frozen previous grid, cell diffs, the acknowledged-geometry pending guard, and the pointer's mapping through a moving pane, so a pointer's cell is the cell it is over), draw.zig's core-composed character effects, animation.zig's transition half, the Surface's tracks and previous grid, the tty's compositor (src/tui/panel_compositor.zig: the glide's rows move into tui.zig) and the window's track groups, frozen old layers, last-frame image snapshot, transition instance fields and shader paths (ui.vert, ui.frag's crossfade, image.vert and image.frag, the transition-.ppm capture); acknowledgePanelPresentation becomes `presented`, which a frontend calls after drawing a frame (a drag's moving end and a look-hover follow what is under the pointer now), and its tape site with it; the pointer tape site goes; GUI golden 18-mid-transition goes, ttyhelp's golden loses the `SPC a` rows (its wait is on `SPC Y` now), the window monkey loses PanelSlide, and the settings behaviour test's floor of on/off words is ten Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- shaders/decor.frag.glsl | 8 ++++---- shaders/image.frag.glsl | 28 ---------------------------- shaders/image.vert.glsl | 16 ---------------- shaders/prebuilt/decor.frag.spv | Bin 7852 -> 3772 bytes shaders/prebuilt/image.frag.spv | Bin 4200 -> 1344 bytes shaders/prebuilt/image.vert.spv | Bin 5032 -> 3152 bytes shaders/prebuilt/ui.frag.spv | Bin 6968 -> 6188 bytes shaders/prebuilt/ui.vert.spv | Bin 5612 -> 4072 bytes shaders/ui.frag.glsl | 26 ++++---------------------- shaders/ui.vert.glsl | 35 ++++++++--------------------------- 10 files changed, 16 insertions(+), 97 deletions(-) (limited to 'shaders') diff --git a/shaders/decor.frag.glsl b/shaders/decor.frag.glsl index 72083ffe..5a6ac458 100644 --- a/shaders/decor.frag.glsl +++ b/shaders/decor.frag.glsl @@ -1,8 +1,8 @@ #version 450 -// Decor, drawn by ui.vert.glsl like a cell, its track's transition included, -// and blended as the overlay pipeline blends (backgroundLayerBlend). Ink (a -// cursor) is drawn with the opacity uniform at 1. +// Decor, drawn by ui.vert.glsl like a cell, and blended as the overlay +// pipeline blends (backgroundLayerBlend). Ink (a cursor) is drawn with the +// opacity uniform at 1. // // Flat: a hard-edged fill (a rule, a rail, a grip mark, a bar cursor). Its // colour rides in the cell's ground (a_bg), its coverage in a_fg.r, so the @@ -18,7 +18,7 @@ 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 = 4) flat in uvec2 v_effect; layout(location = 5) flat in vec4 v_clip; layout(location = 0) out vec4 o_col; diff --git a/shaders/image.frag.glsl b/shaders/image.frag.glsl index 0cc1b2ee..38a95da6 100644 --- a/shaders/image.frag.glsl +++ b/shaders/image.frag.glsl @@ -6,40 +6,12 @@ layout(std140, set = 3, binding = 0) uniform UiUniforms { } 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/image.vert.glsl b/shaders/image.vert.glsl index 04196ce4..ace55a53 100644 --- a/shaders/image.vert.glsl +++ b/shaders/image.vert.glsl @@ -4,13 +4,8 @@ // 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; @@ -34,16 +29,5 @@ void main() { 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/decor.frag.spv b/shaders/prebuilt/decor.frag.spv index bd565d03..6ec3fe61 100644 Binary files a/shaders/prebuilt/decor.frag.spv and b/shaders/prebuilt/decor.frag.spv differ diff --git a/shaders/prebuilt/image.frag.spv b/shaders/prebuilt/image.frag.spv index c9511ad7..d663ed80 100644 Binary files a/shaders/prebuilt/image.frag.spv and b/shaders/prebuilt/image.frag.spv differ diff --git a/shaders/prebuilt/image.vert.spv b/shaders/prebuilt/image.vert.spv index 35165d69..1105bae2 100644 Binary files a/shaders/prebuilt/image.vert.spv and b/shaders/prebuilt/image.vert.spv differ diff --git a/shaders/prebuilt/ui.frag.spv b/shaders/prebuilt/ui.frag.spv index 02e3edc4..aa788c0b 100644 Binary files a/shaders/prebuilt/ui.frag.spv and b/shaders/prebuilt/ui.frag.spv differ diff --git a/shaders/prebuilt/ui.vert.spv b/shaders/prebuilt/ui.vert.spv index af5b0738..4e90e521 100644 Binary files a/shaders/prebuilt/ui.vert.spv and b/shaders/prebuilt/ui.vert.spv differ diff --git a/shaders/ui.frag.glsl b/shaders/ui.frag.glsl index 51ec5b8c..68bfe70b 100644 --- a/shaders/ui.frag.glsl +++ b/shaders/ui.frag.glsl @@ -22,7 +22,7 @@ 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 = 4) flat in uvec2 v_effect; layout(location = 5) flat in vec4 v_clip; layout(location = 0) out vec4 o_col; @@ -31,16 +31,13 @@ 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; 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. + // The 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 & 0x07ffffffu; - float progress = clamp(uintBitsToFloat(v_effect.y), 0.0, 1.0); // 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 @@ -50,9 +47,9 @@ void main() { // dot every period pixels, fixed to the window, under the text. if ((v_effect.x & 0x10000000u) != 0u) { float period = u_ui.decor_dot_geom.x; - // v_effect.z: how far its pane's text has moved the dots (G13's + // v_effect.y: how far its pane's text has moved the dots (G13's // parallax), in pixels, as a float's bits (0 without). - vec2 at = gl_FragCoord.xy - vec2(0.0, uintBitsToFloat(v_effect.z)); + vec2 at = gl_FragCoord.xy - vec2(0.0, uintBitsToFloat(v_effect.y)); vec2 d = mod(at, period) - 0.5 * period; float dot_a = 1.0 - smoothstep(u_ui.decor_dot_geom.y, u_ui.decor_dot_geom.z, length(d)); ground = mix(ground, u_ui.decor_dots.rgb, u_ui.decor_dots.a * dot_a); @@ -72,21 +69,6 @@ void main() { } vec4 cell = vec4(mix(under.rgb, v_fg, a), mix(under.a, 1.0, a)); - // 3 = dissolve, a crossfade (G7): a changed cell's new form is drawn - // first, whole, and its frozen old one over it at 1 - progress, - // premultiplied (the frame's cells blend over, pipeline_over), so the - // old fades out as the new comes in; at the ends, exactly one of them. - // The tty keeps its per-cell swap (panel_animation.dissolveRevealed). - if (effect == 3u) { - if (!oldLayer) { - o_col = cell; - return; - } - if (progress >= 1.0) discard; - o_col = cell * (1.0 - progress); - 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/ui.vert.glsl b/shaders/ui.vert.glsl index de22adee..313070c6 100644 --- a/shaders/ui.vert.glsl +++ b/shaders/ui.vert.glsl @@ -9,28 +9,20 @@ 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 FIVE high effect bits are flags — the frozen-old cell -// layer, a see-through cell background, an opaque block-cursor fill, a soft -// shadow (decor.frag.glsl) or dotted page ground (ui.frag.glsl), and a -// checker (decor) or a file name's shadow (ui) — so the id is what is left -// below them; integer transport preserves the exact -// cross-backend hash. -layout(location = 6) in uvec4 a_effect; +// Flags, and the theme's dots' offset (G13's parallax) as a float's bits. +// The flags are the high bits of x: a see-through cell background, an +// opaque block-cursor fill, a dotted page ground (ui.frag.glsl) and a +// checker (decor) or a file name's shadow (ui). +layout(location = 4) in uvec2 a_effect; // A clip rectangle in target pixels (x0, y0, x1, y1): the fragment shader -// drops what lies outside it. x1 < x0 is none. A vertical transition clips -// its pane's instances to the box the pane is growing into. -layout(location = 7) in vec4 a_clip; +// drops what lies outside it. x1 < x0 is none. +layout(location = 5) in vec4 a_clip; 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; +layout(location = 4) flat out uvec2 v_effect; layout(location = 5) flat out vec4 v_clip; void main() { @@ -62,17 +54,6 @@ void main() { uv = vec2(a_uv_rect.x, a_uv_rect.w); v_cell_uv = vec2(0.0, 1.0); } - - uint effect = a_effect.x & 0x07ffffffu; - 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; -- cgit v1.3