summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 10:46:03 -0300
committerGabriel Schneider <[email protected]>2026-11-05 15:12:36 -0300
commit11204e1206f7f7ffeaa861c1a442a312e563d3ed (patch)
treef788736bf5b6a56694563b664b5db73bc54bff72 /build.zig
parentc9b9dad8469f5d654c31d688d7e2d93da8325f39 (diff)
downloadpardes-11204e1206f7f7ffeaa861c1a442a312e563d3ed.tar.gz
pardes-11204e1206f7f7ffeaa861c1a442a312e563d3ed.zip
effects out, the post chain: Crt, Bloom, Vignette, Grain, Shader and ShaderAnimation go with src/gui/Post.zig, src/ShaderBuild.zig (the run-time glslc spawn and its watched files), shaders/post/, post.vert, bloom-down and bloom-up and their prebuilt .spv, the window's scene texture and its post-chain-only redraw (level A), the disable_scene_effects tape site and Pardes.disableSceneEffects; EffectCode goes with src/effect_sources.zig, which only embedded the effects' sources (/virtual keeps src/); the corner-click test keeps its point without a chain, the window monkey loses its Bloom axis; macOS's post-processor (ScenePostprocessor.swift, crt.ci.metal, pardes_scene) is a change of its own
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig43
1 files changed, 3 insertions, 40 deletions
diff --git a/build.zig b/build.zig
index 60e848e5..2a408bbf 100644
--- a/build.zig
+++ b/build.zig
@@ -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}));
}