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 --- src/effect_sources.zig | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) (limited to 'src/effect_sources.zig') diff --git a/src/effect_sources.zig b/src/effect_sources.zig index 328ce730..f45bf293 100644 --- a/src/effect_sources.zig +++ b/src/effect_sources.zig @@ -3,10 +3,7 @@ const build_config = @import("pardes_config"); const config = @import("config.zig"); const filesystem = @import("fs.zig"); -const shader_dir = if (build_config.gui_shader_sources_prebuilt) - "shaders/prebuilt/" -else - "shaders/"; +const shader_dir = "shaders/"; const ui_vertex_path = shader_dir ++ "ui.vert.glsl"; const ui_fragment_path = shader_dir ++ "ui.frag.glsl"; const image_vertex_path = shader_dir ++ "image.vert.glsl"; @@ -23,28 +20,6 @@ const bloom_up_path = shader_dir ++ "bloom-up.frag.glsl"; pub const Backend = @TypeOf(build_config.platform); pub const backend: Backend = build_config.platform; -pub const GuiShaderSourceMode = enum { - live, - prebuilt_snapshot, - - pub fn label(mode: GuiShaderSourceMode) []const u8 { - return switch (mode) { - .live => "live GLSL compiled during this build", - .prebuilt_snapshot => "paired GLSL snapshot for committed SPIR-V", - }; - } -}; - -/// Only the SDL backend consumes GLSL/SPIR-V. Other backends deliberately have -/// no shader-source mode rather than being mislabeled "live" or "prebuilt". -pub fn guiShaderSourceMode() ?GuiShaderSourceMode { - if (backend != .gui) return null; - return if (build_config.gui_shader_sources_prebuilt) - .prebuilt_snapshot - else - .live; -} - pub const files = switch (backend) { .tty => [_]filesystem.Source{ .{ .path = "src/tty/panel_compositor.zig", .contents = @embedFile("tty/panel_compositor.zig") }, @@ -123,14 +98,3 @@ test "EffectCode paths resolve uniquely to this backend's archived inputs" { try std.testing.expectEqual(backend == .gui, filesystem.sourceBytes("src/gui/gui.zig") != null); try std.testing.expectEqual(backend == .macos, filesystem.sourceBytes("src/macos/Sources/PardesView.swift") != null); } - -test "shader source provenance is GUI-only and follows the build input" { - if (comptime backend == .gui) { - const expected: GuiShaderSourceMode = if (build_config.gui_shader_sources_prebuilt) - .prebuilt_snapshot - else - .live; - try std.testing.expectEqual(expected, guiShaderSourceMode().?); - try std.testing.expect(expected.label().len > 0); - } else try std.testing.expect(guiShaderSourceMode() == null); -} -- cgit v1.3