summaryrefslogtreecommitdiff
path: root/src/FrameStats.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-24 21:30:52 -0300
committerGabriel Schneider <[email protected]>2026-10-24 22:33:46 -0300
commit0dc2dc053af20d6811bfbe09ab31b762862a53a6 (patch)
tree220c02b7d3e6af91ac5eda4f84b9ed965de638b1 /src/FrameStats.zig
parent408412838ce7bf3156ba8aa6f95057a72ebdd284 (diff)
downloadpardes-0dc2dc053af20d6811bfbe09ab31b762862a53a6.tar.gz
pardes-0dc2dc053af20d6811bfbe09ab31b762862a53a6.zip
anim 10: the caret is its own body: drawn from its own springs only, never carried by the text's glide (the ride-along deleted); its target is its cell as the view will settle, so a page leaves it still, a scroll that carries its line moves it there whole at the view's pace, a jump is one ease, a stream of steps lands each
Diffstat (limited to 'src/FrameStats.zig')
-rw-r--r--src/FrameStats.zig12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/FrameStats.zig b/src/FrameStats.zig
index 0b252ff9..ee5ee3f2 100644
--- a/src/FrameStats.zig
+++ b/src/FrameStats.zig
@@ -45,8 +45,10 @@ pub const Frame = struct {
/// The shell had no image to draw into (a busy swapchain).
skipped: bool = false,
/// The shell's motion in it: a scroll's picture offset from the text,
- /// rows (0 at rest).
+ /// rows (0 at rest), and where it drew the caret, its top in rows
+ /// (the jitter check: a caret on a fixed row must not wobble).
scroll: f32 = 0,
+ caret: f32 = 0,
/// From the first input this frame answers to its present's end, µs;
/// 0 when it answers none.
latency_us: u32 = 0,
@@ -84,6 +86,7 @@ skipped: u64 = 0,
/// What the shell sets while it draws the frame (Frame.scroll), and the
/// pump (view).
scroll: f32 = 0,
+caret: f32 = 0,
view: i32 = 0,
/// The first input not yet answered by a drawn frame, monotonic ns.
input_ns: u64 = 0,
@@ -146,6 +149,7 @@ pub fn record(stats: *FrameStats, end_ns: u64, moving: bool, skipped: bool) void
.moving = stats.armed,
.skipped = skipped,
.scroll = stats.scroll,
+ .caret = stats.caret,
.latency_us = if (stats.input_ns == 0) 0 else @max(1, us.of(stats.input_ns, end_ns)),
.view = stats.view,
.zones = stats.zone_us,
@@ -263,13 +267,13 @@ pub fn dump(stats: *const FrameStats, path: [:0]const u8) void {
.phase => |name| write.line(fd, &buf, "# phase {s} {d:.1}\n", .{ name, @as(f64, @floatFromInt((stats.demo_ns + @as(u64, step.at_ms) * std.time.ns_per_ms) -| t0)) / std.time.ns_per_ms }),
else => {},
};
- write.line(fd, &buf, "# start_ms\tupdate_us\trender_us\tpresent_us\tgap_us\tmoving\tskipped\tscroll\tlatency_us\tview", .{});
+ write.line(fd, &buf, "# start_ms\tupdate_us\trender_us\tpresent_us\tgap_us\tmoving\tskipped\tscroll\tcaret\tlatency_us\tview", .{});
inline for (comptime std.enums.values(Zone)) |which| write.line(fd, &buf, "\t{t}_us", .{which});
write.line(fd, &buf, "\tshaped\trastered\tbytes\n", .{});
for (all) |part| for (part) |f| {
- write.line(fd, &buf, "{d:.3}\t{d}\t{d}\t{d}\t{d}\t{d}\t{d}\t{d:.4}\t{d}\t{d}", .{
+ write.line(fd, &buf, "{d:.3}\t{d}\t{d}\t{d}\t{d}\t{d}\t{d}\t{d:.4}\t{d:.4}\t{d}\t{d}", .{
@as(f64, @floatFromInt(f.start_ns -| t0)) / std.time.ns_per_ms, f.update_us, f.render_us, f.present_us, f.gap_us,
- @intFromBool(f.moving), @intFromBool(f.skipped), f.scroll, f.latency_us, f.view,
+ @intFromBool(f.moving), @intFromBool(f.skipped), f.scroll, f.caret, f.latency_us, f.view,
});
for (f.zones) |us| write.line(fd, &buf, "\t{d}", .{us});
write.line(fd, &buf, "\t{d}\t{d}\t{d}\n", .{ f.shaped, f.rastered, f.bytes });