summaryrefslogtreecommitdiff
path: root/src/modules/roto
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-08-06 18:20:33 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-08-06 18:29:36 -0700
commite550c9e8c6ffcdc902b56393609e76a8b191b279 (patch)
tree338093ab62b64ea26b6550361541560148997907 /src/modules/roto
parentf9f3a51227bc6966a7031ce473b3eed6ec89fe2c (diff)
modules/roto: only update fill_fb on changed ticks
In compositions where roto recurs in the same frame, it's wasteful to keep rendering the fill_fb contents manifold for the same tick. They shouldn't be varying anyways... It'd be different if the fill_module rendered directly to the output fragment in an overlay manner, but the current roto implementation doesn't do that. It's just sampling fill_fb like a tiled texture sampler would. The performance hit here is easily observed by doing something like: --module='checkers,size=4,fill_module=roto\,fill_module\=moire' --video=mem --defaults --go Before this change, FPS=1 on my i7 X230. After, FPS=~400.
Diffstat (limited to 'src/modules/roto')
-rw-r--r--src/modules/roto/roto.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c
index f69d010..b040b1d 100644
--- a/src/modules/roto/roto.c
+++ b/src/modules/roto/roto.c
@@ -329,8 +329,8 @@ static void roto_prepare_frame(til_module_context_t *context, til_stream_t *stre
*res_frame_plan = (til_frame_plan_t){ .fragmenter = til_fragmenter_slice_per_cpu_x16 };
- // This governs the rotation and color cycle.
if (ticks != context->last_ticks) {
+ /* This governs the rotation and color cycle. */
ctxt->r += FIXED_TO_INT(FIXED_MULT(FIXED_SIN(ctxt->rr), FIXED_NEW(16)));
ctxt->rr += (ticks - context->last_ticks) >> 2;
@@ -342,13 +342,13 @@ static void roto_prepare_frame(til_module_context_t *context, til_stream_t *stre
ctxt->palette[1].r = (FIXED_MULT(FIXED_SIN(ctxt->rr / 2), FIXED_NEW(127)) + FIXED_NEW(128));
ctxt->palette[1].g = (FIXED_MULT(FIXED_COS(ctxt->rr / 2), FIXED_NEW(127)) + FIXED_NEW(128));
ctxt->palette[1].b = (FIXED_MULT(FIXED_SIN(ctxt->rr), FIXED_NEW(127)) + FIXED_NEW(128));
- }
- if (ctxt->fill_module_context) {
- til_fb_fragment_t *fb_ptr = &ctxt->fill_fb;
+ if (ctxt->fill_module_context) {
+ til_fb_fragment_t *fb_ptr = &ctxt->fill_fb;
- ctxt->fill_fb.cleared = 0;
- til_module_render(ctxt->fill_module_context, stream, ticks, &fb_ptr);
+ ctxt->fill_fb.cleared = 0;
+ til_module_render(ctxt->fill_module_context, stream, ticks, &fb_ptr);
+ }
}
}
© All Rights Reserved