From 1d73823602297ab490dc4222f63c1845f84a9e98 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 10 Dec 2017 09:51:36 -0800 Subject: rototiller: introduce module.finish_frame() Add a hook for post-render serialized frame completion, some of the renderers may have state to cleanup after rendering a frame. A future commit may change add a return value to control flow for features like multi-pass rendering within a given module. The raytracer for example may want to add concurrently executed post filters, and having a non-void return from finish_frame() would be a tidy way to tell rototiller "go back to prepare->render for this context" as many times as necessary, keeping the pass state in the context. For now its return is void however, as I just need a cleanup hook as the raytracer becomes more stateful per frame with a BIH spatial index in the works. --- src/rototiller.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/rototiller.c') diff --git a/src/rototiller.c b/src/rototiller.c index c0a755b..079b0d4 100644 --- a/src/rototiller.c +++ b/src/rototiller.c @@ -70,10 +70,13 @@ static void module_render_page_threaded(rototiller_module_t *module, void *conte static void module_render_page(rototiller_module_t *module, void *context, threads_t *threads, fb_page_t *page) { - if (!module->prepare_frame) - return module->render_fragment(context, &page->fragment); + if (module->prepare_frame) + module_render_page_threaded(module, context, threads, page); + else + module->render_fragment(context, &page->fragment); - module_render_page_threaded(module, context, threads, page); + if (module->finish_frame) + module->finish_frame(context, &page->fragment); } -- cgit v1.2.1