From b1d2c6ae01bf08370e18913ac6a7e8f0074c9113 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 00:13:53 -0300 Subject: gui: gripDecor draws a grip's mode bars from its first row without a loop over the rows it skipped, Post's vignette ceiling is shadowCeiling's (the same sum), ShaderBuild drops expand and a Wake struct whose ctx was never set, and ShaderBuild's and Post's headers say an attached window runs the bundled passes alone (no SPIR-V travels the wire) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/ShaderBuild.zig | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'src/ShaderBuild.zig') diff --git a/src/ShaderBuild.zig b/src/ShaderBuild.zig index e5b6680b..74ec6826 100644 --- a/src/ShaderBuild.zig +++ b/src/ShaderBuild.zig @@ -1,7 +1,7 @@ //! The post chain's Shadertoy files as SPIR-V (docs/render-pipeline.md ยง6), -//! for whichever process holds the core: a local GUI makes its pipelines -//! from them, a detached session sends them to the GUIs attached to it -//! (wire `post`), which never read a disk or run a program themselves. +//! for the window that holds the core, which makes its pipelines from them. +//! A window attached to a session elsewhere compiles none: it runs the +//! bundled passes alone. //! //! Each file compiles behind the prefix by the build's own glslc invocation, //! on a thread of its own and never on the frame path, when it joins the @@ -24,8 +24,8 @@ const prefix = @embedFile("post-prefix.glsl"); /// A pass as a shell draws it: a bundled scene at its level, or a file with /// its last good SPIR-V (empty until a compile succeeds), whose `revision` -/// moves each time that SPIR-V does. Slices borrow the build's (or, in an -/// attached GUI, the client's) storage until its next change. +/// moves each time that SPIR-V does. Slices borrow the build's storage +/// until its next change. pub const Pass = struct { scene: ?Scene = null, level: u8 = 0, @@ -51,10 +51,7 @@ pub fn readsTime(source: []const u8) bool { } /// Who to wake when a compile is done: the host's loop. -pub const Wake = struct { - ctx: ?*anyopaque = null, - call: ?*const fn (?*anyopaque) void = null, -}; +pub const Wake = ?*const fn (?*anyopaque) void; const File = struct { path: []u8 = &.{}, @@ -137,7 +134,7 @@ pub fn sync(b: *Build, gpa: std.mem.Allocator, io: std.Io, core: *pardes.Pardes, b.len = len; var bufs: [max][4096]u8 = undefined; var expanded: [max][]const u8 = undefined; - for (paths[0..len], 0..) |path, i| expanded[i] = expand(&bufs[i], path); + for (paths[0..len], 0..) |path, i| expanded[i] = pardes.filesystem.expandHome(path, &bufs[i]); file_watch.watchShaders(fd, watches, expanded[0..len]); } var stale = false; @@ -241,11 +238,6 @@ fn collect(b: *Build, gpa: std.mem.Allocator, core: *pardes.Pardes, job: *Job) v } } -/// `~` is the home directory (the one rule, filesystem.expandHome). -fn expand(buf: *[4096]u8, path: []const u8) []const u8 { - return pardes.filesystem.expandHome(path, buf); -} - /// The compile thread: each file behind the prefix, through glslc with the /// build's own flags (build.zig compileGlsl), source on stdin, SPIR-V on /// stdout. @@ -255,14 +247,14 @@ fn compile(job: *Job) void { job.results[i] = compileOne(job.gpa, job.io, path, job.known[i]); } job.done.store(true, .release); - if (job.wake.call) |call| call(job.wake.ctx); + if (job.wake) |wake| wake(null); } fn compileOne(gpa: std.mem.Allocator, io: std.Io, path: []const u8, known: ?u64) Result { var home_buf: [4096]u8 = undefined; // Not fs.zig's readFile: that hands the core's turn over for the read, // a turn this thread never holds. - const body = std.Io.Dir.cwd().readFileAlloc(io, expand(&home_buf, path), gpa, .limited(1 << 20)) catch |err| + const body = std.Io.Dir.cwd().readFileAlloc(io, pardes.filesystem.expandHome(path, &home_buf), gpa, .limited(1 << 20)) catch |err| return .{ .failed = .{ .text = std.fmt.allocPrint(gpa, "cannot read it ({t})", .{err}) catch return .none, .source = 0 } }; defer gpa.free(body); const source = std.hash.Wyhash.hash(0, body); @@ -384,11 +376,11 @@ test "a save that changes a file compiles it again, a failed one keeps the last defer b.deinit(gpa, fd, &watches); const settle = struct { fn run(build: *Build, c: *pardes.Pardes, f: c_int, w: *file_watch.Table) void { - _ = build.sync(std.testing.allocator, std.testing.io, c, f, w, .{}); + _ = build.sync(std.testing.allocator, std.testing.io, c, f, w, null); while (build.job) |job| { job.future.await(std.testing.io); job.done.store(true, .release); - _ = build.sync(std.testing.allocator, std.testing.io, c, f, w, .{}); + _ = build.sync(std.testing.allocator, std.testing.io, c, f, w, null); } } }.run; -- cgit v1.3