From ad0f386e1b5cd9148ad278c7f016734af00cd0bc Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 8 Mar 2026 23:38:11 +0100 Subject: ntsc effect for real --- src/shaders/debug/debug_print.wgsl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/shaders/debug') diff --git a/src/shaders/debug/debug_print.wgsl b/src/shaders/debug/debug_print.wgsl index 22b5838..7e6debe 100644 --- a/src/shaders/debug/debug_print.wgsl +++ b/src/shaders/debug/debug_print.wgsl @@ -11,6 +11,8 @@ // each component holds 4 chars (MSB = leftmost char) // e.g. "Hi!" -> vec4u(0x48692100u, 0u, 0u, 0u), 3u +const ink_color = vec4f(1.0, 1.0, 0.0, 1.0); // yellow + // Returns lit pixel (0 or 1) for ASCII code [0x20-0x7E], row r [0-7], col c [0-7]. // Encoding: 2 u32s per glyph; hi covers rows 0-3, lo covers rows 4-7. // Within each u32, row r occupies bits [(3-r%4)*8+7 : (3-r%4)*8]. @@ -217,8 +219,7 @@ fn _dbg_char(ascii: u32, r: u32, c: u32) -> u32 { // pixel_pos : @builtin(position).xy // origin : top-left corner of text in screen pixels // value : f32 to display (format: [-]DDD.DDD, 64×8 px) -fn debug_f32(col: vec3f, pixel_pos: vec2f, origin: vec2f, value: f32) -> vec3f { - let ink_color = vec3f(1.0, 1.0, 0.0); // yellow +fn debug_f32(col: vec4f, pixel_pos: vec2f, origin: vec2f, value: f32) -> vec4f { let lp = pixel_pos - origin; if (lp.x < 0.0 || lp.x >= 64.0 || lp.y < 0.0 || lp.y >= 8.0) { return col; @@ -256,8 +257,8 @@ fn debug_f32(col: vec3f, pixel_pos: vec2f, origin: vec2f, value: f32) -> vec3f { // // Example — "Hello" (5 chars, ASCII 0x48 0x65 0x6C 0x6C 0x6F): // debug_str(col, pos.xy, origin, vec4u(0x48656C6Cu, 0x6F000000u, 0u, 0u), 5u) -fn debug_str(col: vec3f, pixel_pos: vec2f, origin: vec2f, s: vec4u, len: u32) -> vec3f { - let ink_color = vec3f(1.0, 1.0, 0.0); // yellow +fn debug_str(col: vec4f, pixel_pos: vec2f, origin: vec2f, s: vec4u, len: u32) -> +vec4f { let lp = pixel_pos - origin; let max_w = f32(len * 8u); if (lp.x < 0.0 || lp.x >= max_w || lp.y < 0.0 || lp.y >= 8.0) { -- cgit v1.2.3