diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-11-18 14:09:09 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-11-18 14:09:09 -0800 |
commit | c3d7dd19ed1fada9d91237c5a094116ff03f732d (patch) | |
tree | a2a6475e6ee18942ddb2dab8cb4ebd89f579495e | |
parent | cbad9f25255dbfbd2a08055a3c9523c62d7b0185 (diff) |
til: introduce til_module_t.render_proxy() method
Like til_module_t.render_audio(), this hooks into the render path
without triggering the implicit fragment clearing of the usual
render_fragment/prepare_frame/finish_frame methods.
But unlike render_audio(), it receives the full suite of
parameters including the fragment pointer.
The impetus for this is implementing builtins that serve as a
sort of pass-thru or proxy to another module, like the "ref"
builtin (which should probably change to use this instead of its
current render_fragment() hook). Because sometimes the proxied
module isn't something drawing to the fragment, so the implicit
fragment clearing shouldn't occur. But if the proxied module
/does/ touch the fragment by implementing one of those methods,
then the proxy module's use of til_module_render() would still
trigger the implicit clear when appropriate.
-rw-r--r-- | src/til.c | 2 | ||||
-rw-r--r-- | src/til.h | 1 |
2 files changed, 3 insertions, 0 deletions
@@ -297,6 +297,8 @@ static void _til_module_render(til_module_context_t *context, til_stream_t *stre */ if (context->module->render_audio) context->module->render_audio(context, stream, ticks); + else if (context->module->render_proxy) + context->module->render_proxy(context, stream, ticks, fragment_ptr); else module_render_fragment(context, stream, til_threads, n_cpus, ticks, fragment_ptr); @@ -31,6 +31,7 @@ struct til_module_t { til_module_context_t * (*create_context)(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup); void (*destroy_context)(til_module_context_t *context); /* destroy gets stream in context, but the render-related functions should always use the passed-in stream so it can potentially change */ void (*render_audio)(til_module_context_t *context, til_stream_t *stream, unsigned ticks); + void (*render_proxy)(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr); void (*prepare_frame)(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan); void (*render_fragment)(til_module_context_t *context, til_stream_t *stream, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr); int (*finish_frame)(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr); |