summaryrefslogtreecommitdiff
path: root/src/modules/montage
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/montage
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/montage')
-rw-r--r--src/modules/montage/montage.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c
index 645e9da..a7030ff 100644
--- a/src/modules/montage/montage.c
+++ b/src/modules/montage/montage.c
@@ -15,7 +15,7 @@ typedef struct montage_context_t {
} montage_context_t;
static void setup_next_module(montage_context_t *ctxt);
-static void * montage_create_context(unsigned ticks, unsigned n_cpus, til_setup_t *setup);
+static void * montage_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup);
static void montage_destroy_context(void *context);
static void montage_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter);
static void montage_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment);
@@ -31,7 +31,7 @@ til_module_t montage_module = {
};
-static void * montage_create_context(unsigned ticks, unsigned n_cpus, til_setup_t *setup)
+static void * montage_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup)
{
const til_module_t **modules, *rtv_module, *compose_module;
size_t n_modules;
@@ -90,7 +90,7 @@ static void * montage_create_context(unsigned ticks, unsigned n_cpus, til_setup_
(void) til_module_randomize_setup(module, &setup, NULL);
if (module->create_context) /* FIXME errors */
- ctxt->contexts[i] = module->create_context(ticks, 1, setup);
+ ctxt->contexts[i] = module->create_context(rand(), ticks, 1, setup);
til_setup_free(setup);
}
© All Rights Reserved