diff options
| -rw-r--r-- | src/main.zig | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main.zig b/src/main.zig index aeae96e..6d70a14 100644 --- a/src/main.zig +++ b/src/main.zig @@ -117,6 +117,7 @@ pub fn main() !void { const control = try ctrl.ControlServer.init(cfg_allocator, progress, &cache, &config, &constants); defer control.destroy(); + var loops: u8 = 0; while (c.glfwWindowShouldClose(window) == c.GL_FALSE) { c.glfwMakeContextCurrent(window); @@ -134,12 +135,24 @@ pub fn main() !void { // control.reload_requested = false; // } - fbo.bind(); - c.glClear(c.GL_COLOR_BUFFER_BIT); + { + c.glFinish(); + var timer = try std.time.Timer.start(); - main_program.bind(); - constants.normalized_quad.draw(); - fbo.unbind(); + fbo.bind(); + c.glClear(c.GL_COLOR_BUFFER_BIT); + + main_program.bind(); + constants.normalized_quad.draw(); + fbo.unbind(); + + c.glFinish(); + const fps = timer.read(); // ns + loops = (loops + 1) % 64; + if (loops == 0) { + std.debug.print("\rrendered in {d:.2}ms\n", .{@as(f64, @floatFromInt(fps)) / std.time.ns_per_ms}); + } + } for (outputs.items, 0..) |output, i| { const close = output.update(fbo.texture_id); |
