summaryrefslogtreecommitdiff
path: root/src/modules/rtv
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-05-21 20:26:32 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-05-21 20:26:32 -0700
commit9b8660a62e3c5c9ad8f70c0d56ccaac7c4a531fc (patch)
tree039336351d80f7e70e1d136d256a364a93a2da1d /src/modules/rtv
parent192a89a7f9f396fff4eb6b0836f597c376e98932 (diff)
til: supply a seed to til_module_t.create_context()
In the recent surge of ADD-style rtv+compose focused development, a bunch of modules were changed to randomize initial states at context_create() so they wouldn't be so repetitive. But the way this was done in a way that made it impossible to suppress the randomized initial state, which sometimes may be desirable in compositions. Imagine for instance something like the checkers module, rendering one module in the odd cells, and another module into the even cells. Imagine if these modules are actually the same, but if checkers used one seed for all the odd cells and another seed for all the even cells. If the modules used actually utilized the seed provided, checkers would be able to differentiate the odd from even by seeding them differently even when the modules are the same. This commit is a step in that direction, but rototiller and all the composite modules (rtv,compose,montage) are simply passing rand() as the seeds. Also none of the modules have yet been modified to actually make use of these seeds. Subsequent commits will update modules to seed their pseudo-randomized initial state from the seed value rather than always calling things like rand() themselves.
Diffstat (limited to 'src/modules/rtv')
-rw-r--r--src/modules/rtv/rtv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c
index 4dde3bc..6cd9744 100644
--- a/src/modules/rtv/rtv.c
+++ b/src/modules/rtv/rtv.c
@@ -59,7 +59,7 @@ typedef struct rtv_setup_t {
} rtv_setup_t;
static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks);
-static void * rtv_create_context(unsigned ticks, unsigned n_cpus, til_setup_t *setup);
+static void * rtv_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup);
static void rtv_destroy_context(void *context);
static void rtv_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter);
static void rtv_finish_frame(void *context, unsigned ticks, til_fb_fragment_t *fragment);
@@ -186,7 +186,7 @@ static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks)
}
if (!ctxt->channel->module_ctxt)
- (void) til_module_create_context(ctxt->channel->module, ticks, ctxt->channel->module_setup, &ctxt->channel->module_ctxt);
+ (void) til_module_create_context(ctxt->channel->module, rand(), ticks, ctxt->channel->module_setup, &ctxt->channel->module_ctxt);
ctxt->channel->last_on_time = now;
}
@@ -213,7 +213,7 @@ static int rtv_should_skip_module(const rtv_setup_t *setup, const til_module_t *
}
-static void * rtv_create_context(unsigned ticks, unsigned n_cpus, til_setup_t *setup)
+static void * rtv_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup)
{
rtv_context_t *ctxt;
const til_module_t **modules;
@@ -242,7 +242,7 @@ static void * rtv_create_context(unsigned ticks, unsigned n_cpus, til_setup_t *s
ctxt->snow_channel.module = &rtv_none_module;
if (((rtv_setup_t *)setup)->snow_module) {
ctxt->snow_channel.module = til_lookup_module(((rtv_setup_t *)setup)->snow_module);
- (void) til_module_create_context(ctxt->snow_channel.module, ticks, NULL, &ctxt->snow_channel.module_ctxt);
+ (void) til_module_create_context(ctxt->snow_channel.module, rand(), ticks, NULL, &ctxt->snow_channel.module_ctxt);
}
for (size_t i = 0; i < n_modules; i++) {
© All Rights Reserved