summaryrefslogtreecommitdiff
path: root/src/gui/Post.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 16:30:57 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit1ed34e1538f45daecc2c8a551dc0fb7aba5f3f54 (patch)
treeeddcf21a1e5b35f7871b521c747e851b1134f512 /src/gui/Post.zig
parentbe09d1ec7abd71f4e52f05942a941d76b6d420f2 (diff)
downloadpardes-1ed34e1538f45daecc2c8a551dc0fb7aba5f3f54.tar.gz
pardes-1ed34e1538f45daecc2c8a551dc0fb7aba5f3f54.zip
Crt, Ripple and Glitch take a level, 0 to 3, tunable at run time
Coordinator's request: `Crt 0..3` (likewise Ripple, Glitch), 0 off, `on` the default level 2 (the polished rewrite), `off` and a bare word as before. The level is one uniform (pardesLevel, beside pardesOpaque in the prefix's own block); each pass picks its constants by it. Level 3 is at least as strong as the old effects, measured as pixels changed by more than 8 in a channel against a plain frame: Crt 18.3% (old 17.4%), Ripple 11.1% (9.5%), Glitch 9.3% a frame (8.1%); Glitch's level raises how often it bursts as well as how hard. Config and ctl report `Crt 2` / `Crt off`. Shared files touched: ninep/ctl.zig (the report line). Not touched: pardes.zig, Messages.zig, mouse.zig, gui.zig, detached/*.
Diffstat (limited to 'src/gui/Post.zig')
-rw-r--r--src/gui/Post.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/Post.zig b/src/gui/Post.zig
index c529efc0..d9d3d53e 100644
--- a/src/gui/Post.zig
+++ b/src/gui/Post.zig
@@ -69,6 +69,8 @@ pub const Uniforms = extern struct {
pub const Pass = struct {
scene: ?Scene = null,
+ /// A bundled pass's strength (pardesLevel); 0 for a file.
+ level: u8 = 0,
/// A user's file, owned; empty for a bundled pass.
path: []u8 = &.{},
pipeline: ?*Pipeline = null,
@@ -117,7 +119,7 @@ pub fn sync(post: *Post, gpa: std.mem.Allocator, io: std.Io, device: *c.SDL_GPUD
for (chain.list(), 0..) |entry, i| {
if (entry.scene) |scene| {
if (post.bundled.get(scene) == null) post.bundled.set(scene, makePipeline(device, format, bundled_spv.get(scene)) catch null);
- next[i] = .{ .scene = scene, .pipeline = post.bundled.get(scene) };
+ next[i] = .{ .scene = scene, .level = entry.level, .pipeline = post.bundled.get(scene) };
continue;
}
// A file already in the chain keeps its pipeline and its path.
@@ -405,7 +407,6 @@ pub fn draw(post: *Post, device: *c.SDL_GPUDevice, cmd: *c.SDL_GPUCommandBuffer,
const day = epoch.getEpochDay().calculateYearDay();
const month = day.calculateMonthDay();
u.date = .{ @floatFromInt(day.year), @floatFromInt(month.month.numeric() - 1), @floatFromInt(month.day_index + 1), @floatFromInt(epoch.getDaySeconds().secs) };
- const own: [4]f32 = .{ @floatFromInt(@intFromBool(opaque_window)), 0, 0, 0 };
var input = source;
var index: usize = 0;
@@ -423,6 +424,7 @@ pub fn draw(post: *Post, device: *c.SDL_GPUDevice, cmd: *c.SDL_GPUCommandBuffer,
const binding = c.SDL_GPUTextureSamplerBinding{ .texture = input, .sampler = sampler };
c.SDL_BindGPUFragmentSamplers(pass_rp, 0, &binding, 1);
c.SDL_PushGPUFragmentUniformData(cmd, 0, u, @sizeOf(Uniforms));
+ const own: [4]f32 = .{ @floatFromInt(@intFromBool(opaque_window)), @floatFromInt(pass.level), 0, 0 };
c.SDL_PushGPUFragmentUniformData(cmd, 1, &own, @sizeOf(@TypeOf(own)));
c.SDL_DrawGPUPrimitives(pass_rp, 3, 1, 0, 0);
c.SDL_EndGPURenderPass(pass_rp);