diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-07-10 14:36:29 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-07-10 15:15:05 -0700 |
commit | 9f82732e1ece48772d0b1a532a69ff739c9dde16 (patch) | |
tree | 7dd5ef8069c94a7ec91d22453dcbf7174828860a | |
parent | 9d64c336f82a14f19a344825df2ff713aa4e9f08 (diff) |
til: introduce "noop" builtin
When profiling compositions it's convenient to suppress some
modules in the settings to see how their omission affects the
FPS.
There's already a "blank" builtin which clears the fragment, but
there's no way to turn the cost to ~zero. This "noop" builtin
does just that, absolutely nothing - it won't even trigger the
implicit "til_fb_fragment_t.cleared = 1" update so whatever
rendering follows will still find an uncleared fragment if that's
what came into the noop.
-rw-r--r-- | src/til.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -163,6 +163,14 @@ static til_module_t _blank_module = { }; +/* "noop" built-in module */ +static til_module_t _noop_module = { + .name = "noop", + .description = "built-in nothing-doer", + .author = "built-in", +}; + + /* "ref" built-in module */ #include "libs/txt/txt.h" /* for rendering some diagnostics */ @@ -294,6 +302,7 @@ const til_module_t * til_lookup_module(const char *name) { static const til_module_t *builtins[] = { &_blank_module, + &_noop_module, &_ref_module, }; static struct { @@ -380,6 +389,7 @@ char * til_get_module_names(unsigned flags_excluded, const char **exclusions) static void module_render_fragment(til_module_context_t *context, til_stream_t *stream, til_threads_t *threads, unsigned ticks, til_fb_fragment_t **fragment_ptr) { const til_module_t *module; + int touched = 0; assert(context); assert(context->module); @@ -412,13 +422,18 @@ static void module_render_fragment(til_module_context_t *context, til_stream_t * while (frame_plan.fragmenter(context, *fragment_ptr, fragnum++, &frag)) module->render_fragment(context, stream, ticks, 0, &frag_ptr); } - } else if (module->render_fragment) + touched++; + } else if (module->render_fragment) { module->render_fragment(context, stream, ticks, 0, fragment_ptr); + touched++; + } - if (module->finish_frame) + if (module->finish_frame) { module->finish_frame(context, stream, ticks, fragment_ptr); + touched++; + } - (*fragment_ptr)->cleared = 1; + (*fragment_ptr)->cleared = !!touched; } |