13a38303
Add WAYSTTY_BENCH_UNTHROTTLED escape hatch
a73x 2026-04-16 11:28
Commit message
src/main.zig
| Old | New | ||
|---|---|---|---|
| @@ -212,6 +212,17 @@ fn runTerminal(alloc: std.mem.Allocator) !void { | |||
| 212 | else | 212 | else |
| 213 | null; | 213 | null; |
| 214 | 214 | ||
| 215 | const bench_unthrottled = std.posix.getenv("WAYSTTY_BENCH") != null | ||
| 216 | and std.posix.getenv("WAYSTTY_BENCH_UNTHROTTLED") != null; | ||
| 217 | |||
| 218 | if (std.posix.getenv("WAYSTTY_BENCH") != null) { | ||
| 219 | if (bench_unthrottled) { | ||
| 220 | std.debug.print("[bench] mode: UNTHROTTLED (not freeze-safe)\n", .{}); | ||
| 221 | } else { | ||
| 222 | std.debug.print("[bench] mode: THROTTLED (vsync-paced)\n", .{}); | ||
| 223 | } | ||
| 224 | } | ||
| 225 | |||
| 215 | var p = try pty.Pty.spawn(.{ | 226 | var p = try pty.Pty.spawn(.{ |
| 216 | .cols = cols, | 227 | .cols = cols, |
| 217 | .rows = rows, | 228 | .rows = rows, |
| @@ -328,7 +339,7 @@ fn runTerminal(alloc: std.mem.Allocator) !void { | |||
| 328 | } | 339 | } |
| 329 | 340 | ||
| 330 | if (!shouldRenderFrame(render_pending, false, false)) continue; | 341 | if (!shouldRenderFrame(render_pending, false, false)) continue; |
| 331 | if (!frame_loop.canRender()) continue; // hidden — no Vulkan at all | 342 | if (!bench_unthrottled and !frame_loop.canRender()) continue; // hidden — no Vulkan at all |
| 332 | 343 | ||
| 333 | // applyPendingScale — Vulkan work, gated on canRender(). | 344 | // applyPendingScale — Vulkan work, gated on canRender(). |
| 334 | if (scale_pending) { | 345 | if (scale_pending) { |
| @@ -608,7 +619,7 @@ fn runTerminal(alloc: std.mem.Allocator) !void { | |||
| 608 | } | 619 | } |
| 609 | 620 | ||
| 610 | clearConsumedDirtyFlags(&term.render_state.dirty, dirty_rows, refresh_plan); | 621 | clearConsumedDirtyFlags(&term.render_state.dirty, dirty_rows, refresh_plan); |
| 611 | try frame_loop.commitRender(); | 622 | if (!bench_unthrottled) try frame_loop.commitRender(); |
| 612 | render_pending = false; | 623 | render_pending = false; |
| 613 | } | 624 | } |
| 614 | 625 | ||