diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 43 |
1 files changed, 3 insertions, 40 deletions
@@ -57,16 +57,6 @@ const gui_shaders = [_][]const u8{ "overlay.frag", "image.vert", "image.frag", - "post.vert", - // The bundled post passes: shaders/post/<name>.glsl behind the - // Shadertoy prefix (shaderSource). - "post-crt.frag", - "post-bloom.frag", - "post-vignette.frag", - "post-grain.frag", - // Bloom's steps below the frame (src/gui/Post.zig bloomChain). - "bloom-down.frag", - "bloom-up.frag", }; pub fn build(b: *std.Build) void { @@ -857,13 +847,6 @@ pub fn build(b: *std.Build) void { mod.addOptions("doc_typ", doc_typ_opts); 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 = shaderSource(b, name) }, - ); - if (shell == .macos) mod.addAnonymousImport("effect-source-crt.ci.metal", .{ - .root_source_file = b.path("shaders/crt.ci.metal"), - }); } // docs/typ/builtins-<platform>.json: every builtin, from the registry and the Help @@ -960,8 +943,6 @@ pub fn build(b: *std.Build) void { gm.addAnonymousImport("AdwaitaMono-Regular.ttf", .{ .root_source_file = b.path("assets/AdwaitaMono-Regular.ttf"), }); - // Put before a user's Shadertoy file when the gui compiles it. - gm.addAnonymousImport("post-prefix.glsl", .{ .root_source_file = b.path("shaders/post/prefix.glsl") }); for (gui_shaders) |name| gm.addAnonymousImport(b.fmt("{s}.spv", .{name}), .{ .root_source_file = if (prebuilt_shaders) b.path(b.fmt("shaders/prebuilt/{s}.spv", .{name})) @@ -970,11 +951,6 @@ pub fn build(b: *std.Build) void { }); } - // A detached session compiles its attached GUIs' Shadertoy files - // (ShaderBuild.zig), whichever shell it was built for. - if (gui_shell_mod != root_mod) - root_mod.addAnonymousImport("post-prefix.glsl", .{ .root_source_file = b.path("shaders/post/prefix.glsl") }); - if (platform == .macos) { const header = b.addTranslateC(.{ .root_source_file = b.path("src/macos/pardes.h"), @@ -1896,25 +1872,12 @@ fn reindexed(b: *std.Build, archive: std.Build.LazyPath, index: usize) std.Build return run.addOutputFileArg(b.fmt("{d}.a", .{index})); } -// glslc shaders/<name>.glsl -fshader-stage=<vertex|fragment> -o <name>.spv, -// returned as a LazyPath for @embedFile. The stage is the name's own suffix. -/// The GLSL a shader is compiled from: shaders/<name>.glsl, or for a bundled -/// post pass (post-<name>.frag) shaders/post/<name>.glsl behind the Shadertoy -/// prefix, the one the gui puts before a user's file at run time. -fn shaderSource(b: *std.Build, name: []const u8) std.Build.LazyPath { - if (!std.mem.startsWith(u8, name, "post-")) return b.path(b.fmt("shaders/{s}.glsl", .{name})); - const joined = b.addSystemCommand(&.{"cat"}); - joined.addFileArg(b.path("shaders/post/prefix.glsl")); - joined.addFileArg(b.path(b.fmt("shaders/post/{s}.glsl", .{name["post-".len .. name.len - ".frag".len]}))); - return joined.captureStdOut(.{}); -} - -/// The one glslc invocation every shader is compiled with, at build time here -/// and at run time for a user's post pass (src/gui/Post.zig). +/// glslc shaders/<name>.glsl -fshader-stage=<vertex|fragment> -o <name>.spv, +/// returned as a LazyPath for @embedFile. The stage is the name's own suffix. fn compileGlsl(b: *std.Build, name: []const u8) std.Build.LazyPath { const stage = if (std.mem.endsWith(u8, name, ".vert")) "vertex" else "fragment"; const cmd = b.addSystemCommand(&.{ "glslc", b.fmt("-fshader-stage={s}", .{stage}) }); - cmd.addFileArg(shaderSource(b, name)); + cmd.addFileArg(b.path(b.fmt("shaders/{s}.glsl", .{name}))); cmd.addArg("-o"); return cmd.addOutputFileArg(b.fmt("{s}.spv", .{name})); } |
