summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/blinds/blinds.c2
-rw-r--r--src/modules/checkers/checkers.c2
-rw-r--r--src/modules/compose/compose.c2
-rw-r--r--src/modules/drizzle/drizzle.c2
-rw-r--r--src/modules/flui2d/flui2d.c2
-rw-r--r--src/modules/julia/julia.c2
-rw-r--r--src/modules/meta2d/meta2d.c2
-rw-r--r--src/modules/moire/moire.c2
-rw-r--r--src/modules/montage/montage.c2
-rw-r--r--src/modules/pixbounce/pixbounce.c2
-rw-r--r--src/modules/plasma/plasma.c2
-rw-r--r--src/modules/plato/plato.c2
-rw-r--r--src/modules/ray/ray.c2
-rw-r--r--src/modules/rkt/rkt.c2
-rw-r--r--src/modules/roto/roto.c2
-rw-r--r--src/modules/rtv/rtv.c2
-rw-r--r--src/modules/shapes/shapes.c2
-rw-r--r--src/modules/snow/snow.c2
-rw-r--r--src/modules/sparkler/sparkler.c2
-rw-r--r--src/modules/spiro/spiro.c2
-rw-r--r--src/modules/stars/stars.c2
-rw-r--r--src/modules/strobe/strobe.c2
-rw-r--r--src/modules/submit/submit.c2
-rw-r--r--src/modules/swab/swab.c2
-rw-r--r--src/modules/swarm/swarm.c2
-rw-r--r--src/modules/voronoi/voronoi.c2
-rw-r--r--src/til.c2
-rw-r--r--src/til_module_context.c8
-rw-r--r--src/til_module_context.h4
29 files changed, 37 insertions, 29 deletions
diff --git a/src/modules/blinds/blinds.c b/src/modules/blinds/blinds.c
index 7b2f7ac..12de39f 100644
--- a/src/modules/blinds/blinds.c
+++ b/src/modules/blinds/blinds.c
@@ -46,7 +46,7 @@ static til_module_context_t * blinds_create_context(const til_module_t *module,
{
blinds_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(blinds_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(blinds_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c
index 19c1232..5ff33da 100644
--- a/src/modules/checkers/checkers.c
+++ b/src/modules/checkers/checkers.c
@@ -78,7 +78,7 @@ static til_module_context_t * checkers_create_context(const til_module_t *module
if (((checkers_setup_t *)setup)->fill_module)
size += sizeof(til_module_context_t *) * n_cpus;
- ctxt = til_module_context_new(module, size, stream, ticks, seed, n_cpus, path);
+ ctxt = til_module_context_new(module, size, stream, ticks, seed, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c
index 73c0181..376fae4 100644
--- a/src/modules/compose/compose.c
+++ b/src/modules/compose/compose.c
@@ -77,7 +77,7 @@ static til_module_context_t * compose_create_context(const til_module_t *module,
for (n = 0; ((compose_setup_t *)setup)->layers[n]; n++);
- ctxt = til_module_context_new(module, sizeof(compose_context_t) + n * sizeof(compose_layer_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(compose_context_t) + n * sizeof(compose_layer_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/drizzle/drizzle.c b/src/modules/drizzle/drizzle.c
index d91af01..7558ea7 100644
--- a/src/modules/drizzle/drizzle.c
+++ b/src/modules/drizzle/drizzle.c
@@ -95,7 +95,7 @@ static til_module_context_t * drizzle_create_context(const til_module_t *module,
{
drizzle_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(drizzle_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(drizzle_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/flui2d/flui2d.c b/src/modules/flui2d/flui2d.c
index af25549..44a4123 100644
--- a/src/modules/flui2d/flui2d.c
+++ b/src/modules/flui2d/flui2d.c
@@ -254,7 +254,7 @@ static til_module_context_t * flui2d_create_context(const til_module_t *module,
static int initialized;
flui2d_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(flui2d_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(flui2d_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/julia/julia.c b/src/modules/julia/julia.c
index c01059c..3428490 100644
--- a/src/modules/julia/julia.c
+++ b/src/modules/julia/julia.c
@@ -71,7 +71,7 @@ static til_module_context_t * julia_create_context(const til_module_t *module, t
{
julia_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(julia_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(julia_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/meta2d/meta2d.c b/src/modules/meta2d/meta2d.c
index b2782b2..c4fd9f8 100644
--- a/src/modules/meta2d/meta2d.c
+++ b/src/modules/meta2d/meta2d.c
@@ -84,7 +84,7 @@ static til_module_context_t * meta2d_create_context(const til_module_t *module,
{
meta2d_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(meta2d_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(meta2d_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/moire/moire.c b/src/modules/moire/moire.c
index 27d48d9..2c992d6 100644
--- a/src/modules/moire/moire.c
+++ b/src/modules/moire/moire.c
@@ -46,7 +46,7 @@ static til_module_context_t * moire_create_context(const til_module_t *module, t
{
moire_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(moire_context_t) + ((moire_setup_t *)setup)->n_centers * sizeof(moire_center_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(moire_context_t) + ((moire_setup_t *)setup)->n_centers * sizeof(moire_center_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c
index 2d4314a..78d40e2 100644
--- a/src/modules/montage/montage.c
+++ b/src/modules/montage/montage.c
@@ -38,7 +38,7 @@ static til_module_context_t * montage_create_context(const til_module_t *module,
size_t n_modules;
montage_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(montage_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(montage_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/pixbounce/pixbounce.c b/src/modules/pixbounce/pixbounce.c
index 79826ce..f5c2a99 100644
--- a/src/modules/pixbounce/pixbounce.c
+++ b/src/modules/pixbounce/pixbounce.c
@@ -239,7 +239,7 @@ static til_module_context_t * pixbounce_create_context(const til_module_t *modul
{
pixbounce_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(pixbounce_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(pixbounce_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/plasma/plasma.c b/src/modules/plasma/plasma.c
index e6d71dd..e23599a 100644
--- a/src/modules/plasma/plasma.c
+++ b/src/modules/plasma/plasma.c
@@ -64,7 +64,7 @@ static til_module_context_t * plasma_create_context(const til_module_t *module,
init_plasma(costab, sintab);
}
- ctxt = til_module_context_new(module, sizeof(plasma_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(plasma_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/plato/plato.c b/src/modules/plato/plato.c
index 0b584c5..472fba1 100644
--- a/src/modules/plato/plato.c
+++ b/src/modules/plato/plato.c
@@ -634,7 +634,7 @@ static til_module_context_t * plato_create_context(const til_module_t *module, t
{
plato_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(plato_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(plato_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/ray/ray.c b/src/modules/ray/ray.c
index 36532bf..911fe1d 100644
--- a/src/modules/ray/ray.c
+++ b/src/modules/ray/ray.c
@@ -136,7 +136,7 @@ static til_module_context_t * ray_create_context(const til_module_t *module, til
{
ray_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(ray_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(ray_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c
index 6e5d016..23e1b14 100644
--- a/src/modules/rkt/rkt.c
+++ b/src/modules/rkt/rkt.c
@@ -56,7 +56,7 @@ static til_module_context_t * rkt_create_context(const til_module_t *module, til
if (!seq_module)
return NULL;
- ctxt = til_module_context_new(module, sizeof(rkt_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(rkt_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c
index 3883ce5..1838f62 100644
--- a/src/modules/roto/roto.c
+++ b/src/modules/roto/roto.c
@@ -73,7 +73,7 @@ static til_module_context_t * roto_create_context(const til_module_t *module, ti
init_roto(texture, costab, sintab);
}
- ctxt = til_module_context_new(module, sizeof(roto_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(roto_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c
index b48fa6b..f2b92a4 100644
--- a/src/modules/rtv/rtv.c
+++ b/src/modules/rtv/rtv.c
@@ -233,7 +233,7 @@ static til_module_context_t * rtv_create_context(const til_module_t *module, til
n_channels++;
}
- ctxt = til_module_context_new(module, sizeof(rtv_context_t) + n_channels * sizeof(rtv_channel_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(rtv_context_t) + n_channels * sizeof(rtv_channel_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/shapes/shapes.c b/src/modules/shapes/shapes.c
index 053e917..ff25267 100644
--- a/src/modules/shapes/shapes.c
+++ b/src/modules/shapes/shapes.c
@@ -97,7 +97,7 @@ static til_module_context_t * shapes_create_context(const til_module_t *module,
{
shapes_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(shapes_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(shapes_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/snow/snow.c b/src/modules/snow/snow.c
index 8ba0929..7ffd3af 100644
--- a/src/modules/snow/snow.c
+++ b/src/modules/snow/snow.c
@@ -26,7 +26,7 @@ static til_module_context_t * snow_create_context(const til_module_t *module, ti
{
snow_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(snow_context_t) + n_cpus * sizeof(snow_seed_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(snow_context_t) + n_cpus * sizeof(snow_seed_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/sparkler/sparkler.c b/src/modules/sparkler/sparkler.c
index c071617..f35852a 100644
--- a/src/modules/sparkler/sparkler.c
+++ b/src/modules/sparkler/sparkler.c
@@ -37,7 +37,7 @@ static til_module_context_t * sparkler_create_context(const til_module_t *module
{
sparkler_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(sparkler_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(sparkler_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c
index 5c9b447..3fa8f7e 100644
--- a/src/modules/spiro/spiro.c
+++ b/src/modules/spiro/spiro.c
@@ -36,7 +36,7 @@ static til_module_context_t * spiro_create_context(const til_module_t *module, t
spiro_context_t *ctxt;
float z;
- ctxt = til_module_context_new(module, sizeof(spiro_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(spiro_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/stars/stars.c b/src/modules/stars/stars.c
index 51bb1c9..845d945 100644
--- a/src/modules/stars/stars.c
+++ b/src/modules/stars/stars.c
@@ -72,7 +72,7 @@ static til_module_context_t * stars_create_context(const til_module_t *module, t
float z;
struct points* p_ptr = NULL;
- ctxt = til_module_context_new(module, sizeof(stars_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(stars_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/strobe/strobe.c b/src/modules/strobe/strobe.c
index 4d56045..634a46b 100644
--- a/src/modules/strobe/strobe.c
+++ b/src/modules/strobe/strobe.c
@@ -39,7 +39,7 @@ static til_module_context_t * strobe_create_context(const til_module_t *module,
{
strobe_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(strobe_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(strobe_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/submit/submit.c b/src/modules/submit/submit.c
index ea0a56d..43068ed 100644
--- a/src/modules/submit/submit.c
+++ b/src/modules/submit/submit.c
@@ -269,7 +269,7 @@ static til_module_context_t * submit_create_context(const til_module_t *module,
{
submit_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(submit_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(submit_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/swab/swab.c b/src/modules/swab/swab.c
index a94c8f5..bff6f6b 100644
--- a/src/modules/swab/swab.c
+++ b/src/modules/swab/swab.c
@@ -70,7 +70,7 @@ static til_module_context_t * swab_create_context(const til_module_t *module, ti
{
swab_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(swab_context_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(swab_context_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/swarm/swarm.c b/src/modules/swarm/swarm.c
index 8883197..d7f1614 100644
--- a/src/modules/swarm/swarm.c
+++ b/src/modules/swarm/swarm.c
@@ -181,7 +181,7 @@ static til_module_context_t * swarm_create_context(const til_module_t *module, t
{
swarm_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(swarm_context_t) + sizeof(*(ctxt->boids)) * SWARM_SIZE, stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(swarm_context_t) + sizeof(*(ctxt->boids)) * SWARM_SIZE, stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/modules/voronoi/voronoi.c b/src/modules/voronoi/voronoi.c
index 56cbe0c..0248b08 100644
--- a/src/modules/voronoi/voronoi.c
+++ b/src/modules/voronoi/voronoi.c
@@ -77,7 +77,7 @@ static til_module_context_t * voronoi_create_context(const til_module_t *module,
{
voronoi_context_t *ctxt;
- ctxt = til_module_context_new(module, sizeof(voronoi_context_t) + ((voronoi_setup_t *)setup)->n_cells * sizeof(voronoi_cell_t), stream, seed, ticks, n_cpus, path);
+ ctxt = til_module_context_new(module, sizeof(voronoi_context_t) + ((voronoi_setup_t *)setup)->n_cells * sizeof(voronoi_cell_t), stream, seed, ticks, n_cpus, path, setup);
if (!ctxt)
return NULL;
diff --git a/src/til.c b/src/til.c
index 729d447..e71b6a0 100644
--- a/src/til.c
+++ b/src/til.c
@@ -251,7 +251,7 @@ int til_module_create_context(const til_module_t *module, til_stream_t *stream,
n_cpus = til_threads_num_threads(til_threads);
if (!module->create_context)
- context = til_module_context_new(module, sizeof(til_module_context_t), stream, seed, ticks, n_cpus, path);
+ context = til_module_context_new(module, sizeof(til_module_context_t), stream, seed, ticks, n_cpus, path, setup);
else
context = module->create_context(module, stream, seed, ticks, n_cpus, path, setup);
diff --git a/src/til_module_context.c b/src/til_module_context.c
index e065f0d..bf87ce2 100644
--- a/src/til_module_context.c
+++ b/src/til_module_context.c
@@ -6,6 +6,7 @@
#include "til.h"
#include "til_jenkins.h"
#include "til_module_context.h"
+#include "til_setup.h"
#include "til_stream.h"
@@ -28,7 +29,7 @@
*
* path must not be NULL, and the context always takes ownership of the path; it's freed @ context_free().
*/
-void * til_module_context_new(const til_module_t *module, size_t size, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, char *path)
+void * til_module_context_new(const til_module_t *module, size_t size, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup)
{
til_module_context_t *module_context;
@@ -51,6 +52,8 @@ void * til_module_context_new(const til_module_t *module, size_t size, til_strea
module_context->n_cpus = n_cpus;
module_context->path = path;
module_context->path_hash = til_jenkins((uint8_t *)path, strlen(path));
+ if (setup)
+ module_context->setup = til_setup_ref(setup);
return module_context;
}
@@ -65,12 +68,14 @@ void * til_module_context_free(til_module_context_t *module_context)
{
char *path;
til_stream_t *stream;
+ til_setup_t *setup;
if (!module_context)
return NULL;
path = module_context->path; /* free last just in case the module destructor makes use of it */
stream = module_context->stream;
+ setup = module_context->setup;
if (module_context->module->destroy_context)
module_context->module->destroy_context(module_context);
@@ -78,6 +83,7 @@ void * til_module_context_free(til_module_context_t *module_context)
free(module_context);
free(path);
+ (void) til_setup_free(setup);
/* cleanup any pipes this context might have had in the stream, if the
* module's destroy_context() also does this it's harmlessly idempotent
diff --git a/src/til_module_context.h b/src/til_module_context.h
index a11b876..7a5fca5 100644
--- a/src/til_module_context.h
+++ b/src/til_module_context.h
@@ -5,6 +5,7 @@
typedef struct til_module_context_t til_module_context_t;
typedef struct til_module_t til_module_t;
+typedef struct til_setup_t til_setup_t;
typedef struct til_stream_t til_stream_t;
struct til_module_context_t {
@@ -15,9 +16,10 @@ struct til_module_context_t {
unsigned n_cpus;
char *path; /* for locating this instance of the module, NOT a file path */
uint32_t path_hash;
+ til_setup_t *setup; /* optional baked setup this context was made from (reffed by context when present) */
};
-void * til_module_context_new(const til_module_t *module, size_t size, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, char *path);
+void * til_module_context_new(const til_module_t *module, size_t size, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup);
void * til_module_context_free(til_module_context_t *module_context);
#endif
© All Rights Reserved