From 813a0b2bf3c110f2287d7136f0dfc540c0978cd6 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 22:05:58 -0300 Subject: The GUI embeds its shaders' GLSL from shaders/ always: the 14 prebuilt copies, identical to their sources, go, and so does the label saying which was used shaders/prebuilt/*.glsl were byte-identical to shaders/X.glsl or to prefix.glsl + post/X.glsl (checked with cmp, all 14), kept only so a -Dprebuilt-shaders build could name them; EffectCode and Config then labelled the GUI's shader source as live or prebuilt. The GUI embeds shaderSource (a concatenation, no glslc) either way now; the prebuilt SPIR-V stays, and zig build shaders refreshes only it. Config's report and EffectCode lose their GUI shader source line. Co-Authored-By: Claude Opus 5.5 --- build.zig | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index a69327ae..e74bf303 100644 --- a/build.zig +++ b/build.zig @@ -168,14 +168,10 @@ pub fn build(b: *std.Build) void { if (!enable_mupdf) pdf_pointer_bench_step.dependOn(&b.addFail("pdf-pointer-bench is unavailable with -Dmupdf=false").step); - const shaders_step = b.step("shaders", "refresh paired shaders/prebuilt/*.spv + *.glsl snapshots (glslc)"); + const shaders_step = b.step("shaders", "refresh the committed shaders/prebuilt/*.spv (glslc)"); const update_shaders = b.addUpdateSourceFiles(); for (gui_shaders) |name| { update_shaders.addCopyFileToSource(compileGlsl(b, name), b.fmt("shaders/prebuilt/{s}.spv", .{name})); - update_shaders.addCopyFileToSource( - shaderSource(b, name), - b.fmt("shaders/prebuilt/{s}.glsl", .{name}), - ); } shaders_step.dependOn(&update_shaders.step); @@ -999,15 +995,12 @@ pub fn build(b: *std.Build) void { const iso_on = b.addOptions(); iso_on.addOption(bool, "isolated", true); - // Consulted only for a gui shell, so `-Dprebuilt-shaders` alone decides it - // here; the platform half of that condition is the branch it sits in. - const gui_effect_source_dir = if (prebuilt_shaders) "shaders/prebuilt" else "shaders"; for (core_mods, core_shells) |mod, shell| { mod.addOptions("pardes_config", if (also_gui and shell == .gui) gui_opts.? else opts); mod.addOptions("pardes_isolation", if (isolated_mod == mod) iso_on else iso_off); if (shell == .gui) for (gui_shaders) |name| mod.addAnonymousImport( b.fmt("effect-source-{s}.glsl", .{name}), - .{ .root_source_file = if (prebuilt_shaders) b.path(b.fmt("{s}/{s}.glsl", .{ gui_effect_source_dir, name })) else shaderSource(b, name) }, + .{ .root_source_file = shaderSource(b, name) }, ); if (shell == .macos) mod.addAnonymousImport("effect-source-crt.ci.metal", .{ .root_source_file = b.path("shaders/crt.ci.metal"), @@ -1948,9 +1941,6 @@ fn shellOptions(b: *std.Build, cfg: ShellConfig, platform: Platform) *std.Build. o.addOption(u16, "esp32p4_rows", cfg.esp32p4_rows); o.addOption(bool, "workspace_tag", cfg.workspace_tag orelse (platform != .macos)); o.addOption(bool, "theme_animation", cfg.theme_animation orelse (platform != .esp32p4)); - // Meaningful only for the SDL shell. Keeping the platform condition here - // prevents Config/EffectCode from describing tty/macOS/web as "prebuilt". - o.addOption(bool, "gui_shader_sources_prebuilt", platform == .gui and cfg.prebuilt_shaders); o.addOption([]const u8, "zls_version", if (cfg.zls_backend) zls_version else "none"); o.addOption(bool, "embed_sources", cfg.embed_sources); o.addOption([]const u8, "version", zon.version); -- cgit v1.3