summaryrefslogtreecommitdiff
path: root/test/veil.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 05:38:26 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitd3742ddf2b3a85eb3935cb35e958fa27f1293a6b (patch)
treeb47dce7b82e72673432f6c8746517386c67ab742 /test/veil.zig
parentb65048ac19f9f47b6faa21d1a9f3d06ba3ff1a95 (diff)
parent81c4157b6731ee64a7bf9194c5df0818e2977f5d (diff)
downloadpardes-d3742ddf2b3a85eb3935cb35e958fa27f1293a6b.tar.gz
pardes-d3742ddf2b3a85eb3935cb35e958fa27f1293a6b.zip
integration: the GPU move whole, with the terminal a module of its own, the plumber and the diff work
A merge of pardes-next (uoqyunnw) and gpu-s4b (zxswllzu). One conflict, build.zig: core-test's root is the core without a terminal AND the Cells and Atlas tests join the unit suite; gui.zig merged by itself and is formatted (two role casts spelled as zig fmt spells them, two blank lines). Gated against a baseline recorded from pardes-next with the gate's test hooks and the renderer still in gui.zig (.scratch/sketch/gpu/mbase): frame corpus 77/77 identical in Debug and in ReleaseFast, the gated window -0.032% instructions (threshold 0.5%), unit-test on gui 1583/1591 with no failure the baseline has not, every GPU counter 0; on tui core-test 810/949 (139 skipped), shell-test 989/992, behaviour-test 269/273 (the four addon ABI tests the base fails). Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/veil.zig')
-rw-r--r--test/veil.zig37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/veil.zig b/test/veil.zig
new file mode 100644
index 00000000..ed49e1c3
--- /dev/null
+++ b/test/veil.zig
@@ -0,0 +1,37 @@
+//! A test addon whose GPU picture is translucent: its pass draws nothing
+//! and clears to a premultiplied half-alpha colour, so the window's addon
+//! pipeline blends it over the pane (the frame corpus's case for the
+//! pipeline's colour factor, which an opaque picture never shows).
+const std = @import("std");
+const addon = @import("addon");
+const scene = @import("gpu_scene");
+
+pub const Veil = extern struct {
+ painted: u32,
+
+ pub const head: addon.Head = .{ .name = "veil", .version = 1, .words = &.{
+ .{ .name = "Veil", .opens = true, .doc = "a translucent GPU picture over the pane (a test addon)" },
+ } };
+
+ pub fn open(v: *Veil, _: ?[]const u8, _: ?[]const u8) void {
+ v.painted = 0;
+ }
+
+ pub fn paint(_: *const Veil, w: addon.Window, out: addon.Paint) void {
+ w.put(0, 0, "veil over this", .{});
+ const width: u32 = @min(4096, @max(1, @as(u32, w.cols) * w.cell_w));
+ const height: u32 = @min(4096, @max(1, @as(u32, w.rows) * w.cell_h));
+ var buffer: [256]u8 = undefined;
+ var writer: std.Io.Writer = .fixed(&buffer);
+ scene.encode(&writer, .{ .image = .none, .width = width, .height = height, .clear = .{ 0.30, 0.10, 0.20, 0.5 }, .pipelines = &.{}, .draws = &.{} }) catch return;
+ _ = out.gpu(writer.buffered());
+ }
+
+ pub const dump = addon.dumpBytes;
+ pub const load = addon.loadBytes;
+};
+
+pub const pardes_addon = addon.ops(Veil);
+comptime {
+ addon.exportLib(&pardes_addon);
+}