From 25ae095b243cd2fc221200944c0fbcf9cc9429b4 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 29 Aug 2023 11:53:44 -0700 Subject: main: apply submit-to-present delay to ticks This should push the ticks value ahead by 1-2 frames worth of time, when rendering is meeting/exceeding the frame rate. Which is the appropriate thing to do, since rendering is effectively slightly ahead of the clock, producing visuals for now+N-frames into the future. When rendering lags behind, there's basically no delay, and rendering is just operating on the "now" ticks which will be flipped to ASAP once submitted. This will probably be revisited once audio is rolled in, since that too will need to be kept in sync with the visuals' perspective of time. --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index e8a166a..b555bbf 100644 --- a/src/main.c +++ b/src/main.c @@ -336,7 +336,7 @@ static void * rototiller_thread(void *_rt) til_stream_start_frame(rt->stream); ticks = til_ticks_now(); - til_module_render(rt->module_context, rt->stream, ticks, &rt->fragment); + til_module_render(rt->module_context, rt->stream, ticks + delay, &rt->fragment); til_fb_fragment_submit(rt->fragment); if (rt->args.print_module_contexts || rt->args.print_pipes) { -- cgit v1.2.1