summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/til.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/til.c b/src/til.c
index 00b73f6..478d43e 100644
--- a/src/til.c
+++ b/src/til.c
@@ -173,24 +173,27 @@ static void module_render_fragment(til_module_context_t *context, til_threads_t
module = context->module;
- if (context->n_cpus > 1 && module->prepare_frame) {
+ if (module->prepare_frame) {
til_frame_plan_t frame_plan = {};
module->prepare_frame(context, ticks, fragment, &frame_plan);
- if (module->render_fragment) {
+ /* XXX: any module which provides prepare_frame() must return a frame_plan.fragmenter,
+ * and provide render_fragment()
+ */
+ assert(frame_plan.fragmenter);
+ assert(module->render_fragment);
+
+ if (context->n_cpus > 1) {
til_threads_frame_submit(threads, fragment, &frame_plan, module->render_fragment, context, ticks);
til_threads_wait_idle(threads);
- }
- } else if (module->prepare_frame) {
- til_frame_plan_t frame_plan = {};
- unsigned fragnum = 0;
- til_fb_fragment_t frag;
-
- module->prepare_frame(context, ticks, fragment, &frame_plan);
+ } else {
+ unsigned fragnum = 0;
+ til_fb_fragment_t frag;
- while (frame_plan.fragmenter(context, fragment, fragnum++, &frag))
- module->render_fragment(context, ticks, 0, &frag);
+ while (frame_plan.fragmenter(context, fragment, fragnum++, &frag))
+ module->render_fragment(context, ticks, 0, &frag);
+ }
} else if (module->render_fragment)
module->render_fragment(context, ticks, 0, fragment);
© All Rights Reserved