summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/blinds/blinds.c3
-rw-r--r--src/modules/checkers/checkers.c9
-rw-r--r--src/modules/compose/compose.c23
-rw-r--r--src/modules/drizzle/drizzle.c6
-rw-r--r--src/modules/flui2d/flui2d.c9
-rw-r--r--src/modules/julia/julia.c8
-rw-r--r--src/modules/meta2d/meta2d.c12
-rw-r--r--src/modules/moire/moire.c14
-rw-r--r--src/modules/montage/montage.c11
-rw-r--r--src/modules/pixbounce/pixbounce.c5
-rw-r--r--src/modules/plasma/plasma.c22
-rw-r--r--src/modules/plato/plato.c5
-rw-r--r--src/modules/ray/ray.c12
-rw-r--r--src/modules/roto/roto.c8
-rw-r--r--src/modules/rtv/rtv.c13
-rw-r--r--src/modules/shapes/shapes.c4
-rw-r--r--src/modules/snow/snow.c8
-rw-r--r--src/modules/sparkler/sparkler.c6
-rw-r--r--src/modules/spiro/spiro.c10
-rw-r--r--src/modules/stars/stars.c6
-rw-r--r--src/modules/submit/submit.c5
-rw-r--r--src/modules/swab/swab.c20
-rw-r--r--src/modules/swarm/swarm.c5
-rw-r--r--src/modules/voronoi/voronoi.c6
24 files changed, 136 insertions, 94 deletions
diff --git a/src/modules/blinds/blinds.c b/src/modules/blinds/blinds.c
index aa71ddd..d3cddf2 100644
--- a/src/modules/blinds/blinds.c
+++ b/src/modules/blinds/blinds.c
@@ -83,9 +83,10 @@ static inline void draw_blind_vertical(til_fb_fragment_t *fragment, unsigned col
/* draw blinds over the fragment */
-static void blinds_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void blinds_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
blinds_context_t *ctxt = (blinds_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
static float rr;
diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c
index 20ecd63..32b5aa3 100644
--- a/src/modules/checkers/checkers.c
+++ b/src/modules/checkers/checkers.c
@@ -200,9 +200,10 @@ static int checkers_fragmenter(til_module_context_t *context, const til_fb_fragm
}
-static void checkers_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void checkers_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
checkers_context_t *ctxt = (checkers_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
/* XXX: note cpu_affinity is required when fill_module is used, to ensure module_contexts
* have a stable relationship to fragnum. Otherwise the output would be unstable because the
@@ -227,9 +228,11 @@ static inline unsigned hash(unsigned x)
}
-static void checkers_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void checkers_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
checkers_context_t *ctxt = (checkers_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
uint32_t color = ctxt->setup.color, flags = 0;
checkers_fill_t fill = ctxt->setup.fill;
int state;
@@ -293,7 +296,7 @@ static void checkers_render_fragment(til_module_context_t *context, unsigned tic
til_fb_fragment_fill(fragment, flags, color);
else {
/* TODO: we need a way to send down color and flags, and use the module render as a brush of sorts */
- til_module_render(ctxt->fill_module_contexts[cpu], ticks, fragment);
+ til_module_render(ctxt->fill_module_contexts[cpu], ticks, fragment_ptr);
}
}
}
diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c
index ff32ac4..922a9b9 100644
--- a/src/modules/compose/compose.c
+++ b/src/modules/compose/compose.c
@@ -49,7 +49,7 @@ typedef struct compose_setup_t {
static til_module_context_t * compose_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup);
static void compose_destroy_context(til_module_context_t *context);
-static void compose_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment);
+static void compose_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr);
static int compose_setup(const til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup);
static compose_setup_t compose_default_setup = {
@@ -125,9 +125,10 @@ static void compose_destroy_context(til_module_context_t *context)
}
-static void compose_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void compose_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
compose_context_t *ctxt = (compose_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr, *texture = &ctxt->texture_fb;
if (ctxt->texture.module) {
if (!ctxt->texture_fb.buf ||
@@ -146,21 +147,23 @@ static void compose_render_fragment(til_module_context_t *context, unsigned tick
}
ctxt->texture_fb.cleared = 0;
- til_module_render(ctxt->texture.module_ctxt, ticks, &ctxt->texture_fb);
-
- til_module_render(ctxt->layers[0].module_ctxt, ticks, fragment);
+ /* XXX: if when snapshotting becomes a thing, ctxt->texture_fb is snapshottable, this will likely break as-is */
+ til_module_render(ctxt->texture.module_ctxt, ticks, &texture);
+ til_module_render(ctxt->layers[0].module_ctxt, ticks, &fragment);
for (size_t i = 1; i < ctxt->n_layers; i++) {
- til_fb_fragment_t textured = *fragment;
-
- textured.texture = &ctxt->texture_fb;
+ til_fb_fragment_t *old_texture = fragment->texture;
- til_module_render(ctxt->layers[i].module_ctxt, ticks, &textured);
+ fragment->texture = texture;
+ til_module_render(ctxt->layers[i].module_ctxt, ticks, &fragment);
+ fragment->texture = old_texture;
}
} else {
for (size_t i = 0; i < ctxt->n_layers; i++)
- til_module_render(ctxt->layers[i].module_ctxt, ticks, fragment);
+ til_module_render(ctxt->layers[i].module_ctxt, ticks, &fragment);
}
+
+ *fragment_ptr = fragment;
}
diff --git a/src/modules/drizzle/drizzle.c b/src/modules/drizzle/drizzle.c
index ec97d16..fff59bd 100644
--- a/src/modules/drizzle/drizzle.c
+++ b/src/modules/drizzle/drizzle.c
@@ -106,7 +106,7 @@ static void drizzle_destroy_context(til_module_context_t *context)
}
-static void drizzle_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void drizzle_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
drizzle_context_t *ctxt = (drizzle_context_t *)context;
@@ -130,9 +130,11 @@ static void drizzle_prepare_frame(til_module_context_t *context, unsigned ticks,
}
-static void drizzle_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void drizzle_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
drizzle_context_t *ctxt = (drizzle_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
float xf = 1.f / (float)fragment->frame_width;
float yf = 1.f / (float)fragment->frame_height;
v2f_t coord;
diff --git a/src/modules/flui2d/flui2d.c b/src/modules/flui2d/flui2d.c
index cb249c3..5272e4d 100644
--- a/src/modules/flui2d/flui2d.c
+++ b/src/modules/flui2d/flui2d.c
@@ -273,10 +273,12 @@ static til_module_context_t * flui2d_create_context(unsigned seed, unsigned tick
/* Prepare a frame for concurrent drawing of fragment using multiple fragments */
-static void flui2d_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void flui2d_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
flui2d_context_t *ctxt = (flui2d_context_t *)context;
- float r = (ticks % (unsigned)(2 * M_PI * 1000)) * .001f;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
+ float r = (ticks % (unsigned)(2 * M_PI * 1000)) * .001f;
*res_frame_plan = (til_frame_plan_t){ .fragmenter = til_fragmenter_tile64 };
@@ -332,9 +334,10 @@ static void flui2d_prepare_frame(til_module_context_t *context, unsigned ticks,
/* Draw a the flui2d densities */
-static void flui2d_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void flui2d_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
flui2d_context_t *ctxt = (flui2d_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
for (int y = fragment->y; y < fragment->y + fragment->height; y++) {
int y0, y1;
diff --git a/src/modules/julia/julia.c b/src/modules/julia/julia.c
index aa05dd8..2668061 100644
--- a/src/modules/julia/julia.c
+++ b/src/modules/julia/julia.c
@@ -106,7 +106,7 @@ static inline unsigned julia_iter(float real, float imag, float creal, float cim
/* Prepare a frame for concurrent drawing of fragment using multiple fragments */
-static void julia_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void julia_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
julia_context_t *ctxt = (julia_context_t *)context;
@@ -133,9 +133,11 @@ static void julia_prepare_frame(til_module_context_t *context, unsigned ticks, t
/* Draw a morphing Julia set */
-static void julia_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void julia_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- julia_context_t *ctxt = (julia_context_t *)context;
+ julia_context_t *ctxt = (julia_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
unsigned x, y;
unsigned width = fragment->width, height = fragment->height;
uint32_t *buf = fragment->buf;
diff --git a/src/modules/meta2d/meta2d.c b/src/modules/meta2d/meta2d.c
index b7b6708..8af3981 100644
--- a/src/modules/meta2d/meta2d.c
+++ b/src/modules/meta2d/meta2d.c
@@ -101,7 +101,7 @@ static void meta2d_destroy_context(til_module_context_t *context)
}
-static void meta2d_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void meta2d_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
meta2d_context_t *ctxt = (meta2d_context_t *)context;
@@ -178,12 +178,14 @@ static void meta2d_prepare_frame(til_module_context_t *context, unsigned ticks,
}
-static void meta2d_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void meta2d_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
meta2d_context_t *ctxt = (meta2d_context_t *)context;
- float xf = 2.f / (float)fragment->frame_width;
- float yf = 2.f / (float)fragment->frame_height;
- v2f_t coord;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
+ float xf = 2.f / (float)fragment->frame_width;
+ float yf = 2.f / (float)fragment->frame_height;
+ v2f_t coord;
for (int y = fragment->y; y < fragment->y + fragment->height; y++) {
coord.y = yf * (float)y - 1.f;
diff --git a/src/modules/moire/moire.c b/src/modules/moire/moire.c
index ceeefe0..d528f8c 100644
--- a/src/modules/moire/moire.c
+++ b/src/modules/moire/moire.c
@@ -71,7 +71,7 @@ static til_module_context_t * moire_create_context(unsigned seed, unsigned ticks
}
-static void moire_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void moire_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
moire_context_t *ctxt = (moire_context_t *)context;
@@ -84,12 +84,14 @@ static void moire_prepare_frame(til_module_context_t *context, unsigned ticks, t
}
-static void moire_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void moire_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- moire_context_t *ctxt = (moire_context_t *)context;
- float xf = 2.f / (float)fragment->frame_width;
- float yf = 2.f / (float)fragment->frame_height;
- float cx, cy;
+ moire_context_t *ctxt = (moire_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
+ float xf = 2.f / (float)fragment->frame_width;
+ float yf = 2.f / (float)fragment->frame_height;
+ float cx, cy;
/* TODO: optimize */
cy = yf * (float)fragment->y - 1.f;
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c
index 7991e3f..eaf8be7 100644
--- a/src/modules/montage/montage.c
+++ b/src/modules/montage/montage.c
@@ -18,8 +18,8 @@ typedef struct montage_context_t {
static til_module_context_t * montage_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup);
static void montage_destroy_context(til_module_context_t *context);
-static void montage_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan);
-static void montage_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment);
+static void montage_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan);
+static void montage_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr);
til_module_t montage_module = {
@@ -184,15 +184,16 @@ static int montage_fragmenter(til_module_context_t *context, const til_fb_fragme
}
-static void montage_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void montage_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
*res_frame_plan = (til_frame_plan_t){ .fragmenter = montage_fragmenter };
}
-static void montage_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void montage_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
montage_context_t *ctxt = (montage_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
if (fragment->number >= ctxt->n_modules) {
til_fb_fragment_clear(fragment);
@@ -200,5 +201,5 @@ static void montage_render_fragment(til_module_context_t *context, unsigned tick
return;
}
- til_module_render(ctxt->contexts[fragment->number], ticks, fragment);
+ til_module_render(ctxt->contexts[fragment->number], ticks, fragment_ptr);
}
diff --git a/src/modules/pixbounce/pixbounce.c b/src/modules/pixbounce/pixbounce.c
index d200ad6..6a6bfb3 100644
--- a/src/modules/pixbounce/pixbounce.c
+++ b/src/modules/pixbounce/pixbounce.c
@@ -260,9 +260,10 @@ static til_module_context_t * pixbounce_create_context(unsigned seed, unsigned t
return &ctxt->til_module_context;
}
-static void pixbounce_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void pixbounce_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- pixbounce_context_t *ctxt = (pixbounce_context_t *)context;
+ pixbounce_context_t *ctxt = (pixbounce_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
int width = fragment->width, height = fragment->height;
diff --git a/src/modules/plasma/plasma.c b/src/modules/plasma/plasma.c
index 8cc4fda..b58e34f 100644
--- a/src/modules/plasma/plasma.c
+++ b/src/modules/plasma/plasma.c
@@ -75,7 +75,7 @@ static til_module_context_t * plasma_create_context(unsigned seed, unsigned tick
/* Prepare a frame for concurrent drawing of fragment using multiple fragments */
-static void plasma_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void plasma_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
plasma_context_t *ctxt = (plasma_context_t *)context;
@@ -85,17 +85,19 @@ static void plasma_prepare_frame(til_module_context_t *context, unsigned ticks,
/* Draw a plasma effect */
-static void plasma_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void plasma_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
plasma_context_t *ctxt = (plasma_context_t *)context;
- int xstep = PLASMA_WIDTH / fragment->frame_width;
- int ystep = PLASMA_HEIGHT / fragment->frame_height;
- unsigned width = fragment->width * xstep, height = fragment->height * ystep;
- int fw2 = FIXED_NEW(width / 2), fh2 = FIXED_NEW(height / 2);
- int x, y, cx, cy, dx2, dy2;
- uint32_t *buf = fragment->buf;
- color_t c = { .r = 0, .g = 0, .b = 0 }, cscale;
- unsigned rr2, rr6, rr8, rr16, rr20, rr12;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
+ int xstep = PLASMA_WIDTH / fragment->frame_width;
+ int ystep = PLASMA_HEIGHT / fragment->frame_height;
+ unsigned width = fragment->width * xstep, height = fragment->height * ystep;
+ int fw2 = FIXED_NEW(width / 2), fh2 = FIXED_NEW(height / 2);
+ int x, y, cx, cy, dx2, dy2;
+ uint32_t *buf = fragment->buf;
+ color_t c = { .r = 0, .g = 0, .b = 0 }, cscale;
+ unsigned rr2, rr6, rr8, rr16, rr20, rr12;
rr2 = ctxt->rr * 2;
rr6 = ctxt->rr * 6;
diff --git a/src/modules/plato/plato.c b/src/modules/plato/plato.c
index 43d9bdd..f56bef8 100644
--- a/src/modules/plato/plato.c
+++ b/src/modules/plato/plato.c
@@ -622,9 +622,10 @@ static til_module_context_t * plato_create_context(unsigned seed, unsigned ticks
}
-static void plato_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void plato_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- plato_context_t *ctxt = (plato_context_t *)context;
+ plato_context_t *ctxt = (plato_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
ctxt->r += (float)(ticks - context->ticks) * .001f;
context->ticks = ticks;
diff --git a/src/modules/ray/ray.c b/src/modules/ray/ray.c
index ead6636..9814dcc 100644
--- a/src/modules/ray/ray.c
+++ b/src/modules/ray/ray.c
@@ -145,9 +145,10 @@ static til_module_context_t * ray_create_context(unsigned seed, unsigned ticks,
/* prepare a frame for concurrent rendering */
-static void ray_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void ray_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
- ray_context_t *ctxt = (ray_context_t *)context;
+ ray_context_t *ctxt = (ray_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
*res_frame_plan = (til_frame_plan_t){ .fragmenter = til_fragmenter_tile64 };
#if 1
@@ -177,15 +178,16 @@ static void ray_prepare_frame(til_module_context_t *context, unsigned ticks, til
/* ray trace a simple scene into the fragment */
-static void ray_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void ray_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- ray_context_t *ctxt = (ray_context_t *)context;
+ ray_context_t *ctxt = (ray_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
ray_render_trace_fragment(ctxt->render, fragment);
}
-static void ray_finish_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment)
+static void ray_finish_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr)
{
ray_context_t *ctxt = (ray_context_t *)context;
diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c
index a8ee45d..e2abea3 100644
--- a/src/modules/roto/roto.c
+++ b/src/modules/roto/roto.c
@@ -174,7 +174,7 @@ static void init_roto(uint8_t texture[256][256], int32_t *costab, int32_t *sinta
/* prepare a frame for concurrent rendering */
-static void roto_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void roto_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
roto_context_t *ctxt = (roto_context_t *)context;
static int initialized;
@@ -207,9 +207,11 @@ static void roto_prepare_frame(til_module_context_t *context, unsigned ticks, ti
/* Draw a rotating checkered 256x256 texture into fragment. */
-static void roto_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void roto_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- roto_context_t *ctxt = (roto_context_t *)context;
+ roto_context_t *ctxt = (roto_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
int x, y, frame_width = fragment->frame_width, frame_height = fragment->frame_height;
int y_cos_r, y_sin_r, x_cos_r, x_sin_r, x_cos_r_init, x_sin_r_init, cos_r, sin_r;
uint32_t *buf = fragment->buf;
diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c
index 3a8e7fc..13c8da9 100644
--- a/src/modules/rtv/rtv.c
+++ b/src/modules/rtv/rtv.c
@@ -63,8 +63,8 @@ typedef struct rtv_setup_t {
static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks);
static til_module_context_t * rtv_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup);
static void rtv_destroy_context(til_module_context_t *context);
-static void rtv_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment);
-static void rtv_finish_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment);
+static void rtv_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr);
+static void rtv_finish_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr);
static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup);
static rtv_setup_t rtv_default_setup = {
@@ -268,7 +268,7 @@ static void rtv_destroy_context(til_module_context_t *context)
}
-static void rtv_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void rtv_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
rtv_context_t *ctxt = (rtv_context_t *)context;
time_t now = time(NULL);
@@ -279,13 +279,14 @@ static void rtv_render_fragment(til_module_context_t *context, unsigned ticks, u
if (now >= ctxt->next_hide_caption)
ctxt->caption = NULL;
- til_module_render(ctxt->channel->module_ctxt, ticks, fragment);
+ til_module_render(ctxt->channel->module_ctxt, ticks, fragment_ptr);
}
-static void rtv_finish_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment)
+static void rtv_finish_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr)
{
- rtv_context_t *ctxt = (rtv_context_t *)context;
+ rtv_context_t *ctxt = (rtv_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
if (!ctxt->caption)
return;
diff --git a/src/modules/shapes/shapes.c b/src/modules/shapes/shapes.c
index 47bb8df..bce0a37 100644
--- a/src/modules/shapes/shapes.c
+++ b/src/modules/shapes/shapes.c
@@ -115,9 +115,11 @@ static til_module_context_t * shapes_create_context(unsigned seed, unsigned tick
}
-static void shapes_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void shapes_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
shapes_context_t *ctxt = (shapes_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
unsigned size = MIN(fragment->frame_width, fragment->frame_height) * ctxt->setup.scale;
unsigned xoff = (fragment->frame_width - size) >> 1;
unsigned yoff = (fragment->frame_height - size) >> 1;
diff --git a/src/modules/snow/snow.c b/src/modules/snow/snow.c
index a367113..1a171ee 100644
--- a/src/modules/snow/snow.c
+++ b/src/modules/snow/snow.c
@@ -37,15 +37,17 @@ static til_module_context_t * snow_create_context(unsigned seed, unsigned ticks,
}
-static void snow_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void snow_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
*res_frame_plan = (til_frame_plan_t){ .fragmenter = til_fragmenter_slice_per_cpu };
}
-static void snow_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void snow_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- snow_context_t *ctxt = (snow_context_t *)context;
+ snow_context_t *ctxt = (snow_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
unsigned *seed = &ctxt->seeds[cpu].seed;
for (unsigned y = fragment->y; y < fragment->y + fragment->height; y++) {
diff --git a/src/modules/sparkler/sparkler.c b/src/modules/sparkler/sparkler.c
index f0f2cb6..339e3e9 100644
--- a/src/modules/sparkler/sparkler.c
+++ b/src/modules/sparkler/sparkler.c
@@ -75,9 +75,10 @@ static void sparkler_destroy_context(til_module_context_t *context)
}
-static void sparkler_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void sparkler_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
sparkler_context_t *ctxt = (sparkler_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
*res_frame_plan = (til_frame_plan_t){ .fragmenter = til_fragmenter_slice_per_cpu };
@@ -91,9 +92,10 @@ static void sparkler_prepare_frame(til_module_context_t *context, unsigned ticks
/* Render a 3D particle system */
-static void sparkler_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void sparkler_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
sparkler_context_t *ctxt = (sparkler_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
if (!ctxt->setup.show_bsp_matches)
til_fb_fragment_clear(fragment);
diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c
index 30e5f06..76b3a80 100644
--- a/src/modules/spiro/spiro.c
+++ b/src/modules/spiro/spiro.c
@@ -53,13 +53,13 @@ static til_module_context_t * spiro_create_context(unsigned seed, unsigned ticks
return &ctxt->til_module_context;
}
-static void spiro_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void spiro_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- spiro_context_t *ctxt = (spiro_context_t *)context;
+ spiro_context_t *ctxt = (spiro_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
- int width = fragment->frame_width, height = fragment->frame_height;
-
- int display_R, display_origin_x, display_origin_y;
+ int width = fragment->frame_width, height = fragment->frame_height;
+ int display_R, display_origin_x, display_origin_y;
/* Based on the fragment's dimensions, calculate the origin and radius of the fixed outer
circle, C0. */
diff --git a/src/modules/stars/stars.c b/src/modules/stars/stars.c
index 3a3f90f..8e6a5d0 100644
--- a/src/modules/stars/stars.c
+++ b/src/modules/stars/stars.c
@@ -109,9 +109,11 @@ static void stars_destroy_context(til_module_context_t *context)
}
-static void stars_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void stars_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- stars_context_t *ctxt = (stars_context_t *)context;
+ stars_context_t *ctxt = (stars_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
struct points* iterator;
struct points* tmp_ptr;
struct points* last_ptr=NULL;
diff --git a/src/modules/submit/submit.c b/src/modules/submit/submit.c
index daac37b..5f46461 100644
--- a/src/modules/submit/submit.c
+++ b/src/modules/submit/submit.c
@@ -294,7 +294,7 @@ static void submit_destroy_context(til_module_context_t *context)
}
-static void submit_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void submit_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
submit_context_t *ctxt = (submit_context_t *)context;
@@ -317,9 +317,10 @@ static void submit_prepare_frame(til_module_context_t *context, unsigned ticks,
}
-static void submit_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void submit_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
submit_context_t *ctxt = (submit_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
if (!ctxt->bilerp)
draw_grid(ctxt, fragment);
diff --git a/src/modules/swab/swab.c b/src/modules/swab/swab.c
index 9047f68..6d1c3d9 100644
--- a/src/modules/swab/swab.c
+++ b/src/modules/swab/swab.c
@@ -93,7 +93,7 @@ static void swab_destroy_context(til_module_context_t *context)
}
-static void swab_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void swab_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
swab_context_t *ctxt = (swab_context_t *)context;
@@ -103,15 +103,17 @@ static void swab_prepare_frame(til_module_context_t *context, unsigned ticks, ti
}
-static void swab_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void swab_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- swab_context_t *ctxt = (swab_context_t *)context;
- float cos_r = cos(ctxt->r);
- float sin_r = sin(ctxt->r);
- float z1 = cos_r;
- float z2 = sin_r;
- float xscale = 1.f / (float)fragment->frame_width;
- float yscale = 1.f / (float)fragment->frame_height;
+ swab_context_t *ctxt = (swab_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
+
+ float cos_r = cos(ctxt->r);
+ float sin_r = sin(ctxt->r);
+ float z1 = cos_r;
+ float z2 = sin_r;
+ float xscale = 1.f / (float)fragment->frame_width;
+ float yscale = 1.f / (float)fragment->frame_height;
for (int y = fragment->y; y < fragment->y + fragment->height; y++) {
float yscaled = (float)y * yscale;
diff --git a/src/modules/swarm/swarm.c b/src/modules/swarm/swarm.c
index 0c58bf9..c896735 100644
--- a/src/modules/swarm/swarm.c
+++ b/src/modules/swarm/swarm.c
@@ -401,9 +401,10 @@ static void swarm_draw_as_lines(swarm_context_t *ctxt, til_fb_fragment_t *fragme
}
-static void swarm_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void swarm_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
- swarm_context_t *ctxt = (swarm_context_t *)context;
+ swarm_context_t *ctxt = (swarm_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
swarm_update(ctxt, ticks);
diff --git a/src/modules/voronoi/voronoi.c b/src/modules/voronoi/voronoi.c
index 8e9a0f3..2d1c8e5 100644
--- a/src/modules/voronoi/voronoi.c
+++ b/src/modules/voronoi/voronoi.c
@@ -281,9 +281,10 @@ static void voronoi_sample_colors(voronoi_context_t *ctxt, til_fb_fragment_t *fr
}
-static void voronoi_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void voronoi_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
voronoi_context_t *ctxt = (voronoi_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
*res_frame_plan = (til_frame_plan_t){ .fragmenter = til_fragmenter_tile64 };
@@ -314,9 +315,10 @@ static void voronoi_prepare_frame(til_module_context_t *context, unsigned ticks,
}
-static void voronoi_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void voronoi_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
voronoi_context_t *ctxt = (voronoi_context_t *)context;
+ til_fb_fragment_t *fragment = *fragment_ptr;
for (int y = 0; y < fragment->height; y++) {
for (int x = 0; x < fragment->width; x++) {
© All Rights Reserved