From 6bfd66051632fdb8eca4103df2c3c67492d28af7 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 23 Nov 2019 16:59:59 -0800 Subject: rototiller: pass cpu to .render_fragment() Mostly mechanical change, though threads.c needed some jiggering to make the logical cpu id available to the worker threads. Now render_fragment() can easily addresss per-cpu data created by create_context(). --- src/modules/flui2d/flui2d.c | 2 +- src/modules/julia/julia.c | 2 +- src/modules/pixbounce/pixbounce.c | 2 +- src/modules/plasma/plasma.c | 2 +- src/modules/ray/ray.c | 2 +- src/modules/roto/roto.c | 2 +- src/modules/snow/snow.c | 2 +- src/modules/sparkler/sparkler.c | 2 +- src/modules/stars/stars.c | 2 +- src/modules/submit/submit.c | 2 +- src/modules/swab/swab.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/modules') diff --git a/src/modules/flui2d/flui2d.c b/src/modules/flui2d/flui2d.c index 624202b..1464c7d 100644 --- a/src/modules/flui2d/flui2d.c +++ b/src/modules/flui2d/flui2d.c @@ -247,7 +247,7 @@ static void flui2d_prepare_frame(void *context, unsigned n_cpus, fb_fragment_t * /* Draw a the flui2d densities */ -static void flui2d_render_fragment(void *context, fb_fragment_t *fragment) +static void flui2d_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { flui2d_context_t *ctxt = context; diff --git a/src/modules/julia/julia.c b/src/modules/julia/julia.c index 61ed102..ff44a70 100644 --- a/src/modules/julia/julia.c +++ b/src/modules/julia/julia.c @@ -139,7 +139,7 @@ static void julia_prepare_frame(void *context, unsigned n_cpus, fb_fragment_t *f /* Draw a morphing Julia set */ -static void julia_render_fragment(void *context, fb_fragment_t *fragment) +static void julia_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { julia_context_t *ctxt = context; unsigned x, y; diff --git a/src/modules/pixbounce/pixbounce.c b/src/modules/pixbounce/pixbounce.c index 764f559..bfc7693 100644 --- a/src/modules/pixbounce/pixbounce.c +++ b/src/modules/pixbounce/pixbounce.c @@ -101,7 +101,7 @@ static int pick_pix(int num_pics, int last_pic) return pix_num; } -static void pixbounce_render_fragment(void *context, fb_fragment_t *fragment) +static void pixbounce_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { static int initialized=0; static int x, y, multiplier; diff --git a/src/modules/plasma/plasma.c b/src/modules/plasma/plasma.c index 731838f..cf32a41 100644 --- a/src/modules/plasma/plasma.c +++ b/src/modules/plasma/plasma.c @@ -86,7 +86,7 @@ static void plasma_prepare_frame(void *context, unsigned n_cpus, fb_fragment_t * /* Draw a plasma effect */ -static void plasma_render_fragment(void *context, fb_fragment_t *fragment) +static void plasma_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { plasma_context_t *ctxt = context; unsigned width = fragment->width, height = fragment->height; diff --git a/src/modules/ray/ray.c b/src/modules/ray/ray.c index 99e6609..ad710bc 100644 --- a/src/modules/ray/ray.c +++ b/src/modules/ray/ray.c @@ -179,7 +179,7 @@ static void ray_prepare_frame(void *context, unsigned n_cpus, fb_fragment_t *fra /* ray trace a simple scene into the fragment */ -static void ray_render_fragment(void *context, fb_fragment_t *fragment) +static void ray_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { ray_context_t *ctxt = context; diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c index 050b129..8e91c89 100644 --- a/src/modules/roto/roto.c +++ b/src/modules/roto/roto.c @@ -199,7 +199,7 @@ static void roto_prepare_frame(void *context, unsigned n_cpus, fb_fragment_t *fr /* Draw a rotating checkered 256x256 texture into fragment. */ -static void roto_render_fragment(void *context, fb_fragment_t *fragment) +static void roto_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { roto_context_t *ctxt = context; 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; diff --git a/src/modules/snow/snow.c b/src/modules/snow/snow.c index f3c20d5..cf3ffa7 100644 --- a/src/modules/snow/snow.c +++ b/src/modules/snow/snow.c @@ -29,7 +29,7 @@ static void snow_prepare_frame(void *context, unsigned n_cpus, fb_fragment_t *fr } -static void snow_render_fragment(void *context, fb_fragment_t *fragment) +static void snow_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { for (unsigned y = fragment->y; y < fragment->y + fragment->height; y++) { for (unsigned x = fragment->x; x < fragment->x + fragment->width; x++) { diff --git a/src/modules/sparkler/sparkler.c b/src/modules/sparkler/sparkler.c index 9462438..12138c9 100644 --- a/src/modules/sparkler/sparkler.c +++ b/src/modules/sparkler/sparkler.c @@ -80,7 +80,7 @@ static void sparkler_prepare_frame(void *context, unsigned ncpus, fb_fragment_t /* Render a 3D particle system */ -static void sparkler_render_fragment(void *context, fb_fragment_t *fragment) +static void sparkler_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { sparkler_context_t *ctxt = context; diff --git a/src/modules/stars/stars.c b/src/modules/stars/stars.c index 7c2f5f2..63ff73c 100644 --- a/src/modules/stars/stars.c +++ b/src/modules/stars/stars.c @@ -13,7 +13,7 @@ /* Copyright (C) 2017 Philip J. Freeman */ -static void stars_render_fragment(void *context, fb_fragment_t *fragment) +static void stars_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { static int initialized, z; static struct universe* u; diff --git a/src/modules/submit/submit.c b/src/modules/submit/submit.c index 340783c..254cc78 100644 --- a/src/modules/submit/submit.c +++ b/src/modules/submit/submit.c @@ -311,7 +311,7 @@ static void submit_prepare_frame(void *context, unsigned n_cpus, fb_fragment_t * } -static void submit_render_fragment(void *context, fb_fragment_t *fragment) +static void submit_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { submit_context_t *ctxt = context; diff --git a/src/modules/swab/swab.c b/src/modules/swab/swab.c index aa53566..9c26da2 100644 --- a/src/modules/swab/swab.c +++ b/src/modules/swab/swab.c @@ -106,7 +106,7 @@ static void swab_prepare_frame(void *context, unsigned n_cpus, fb_fragment_t *fr } -static void swab_render_fragment(void *context, fb_fragment_t *fragment) +static void swab_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) { swab_context_t *ctxt = context; float cos_r = cos(ctxt->r); -- cgit v1.2.3