diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2019-11-23 16:08:07 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2019-11-23 16:14:34 -0800 |
commit | ade362b53d721bc2e2c7a62a30c4345014e5f5ce (patch) | |
tree | 028914a89365c43047ecb9af1368d8c3304f7e5c /src/rototiller.c | |
parent | 796b3a8b0669ee5e09c6faba6614e3f228d36595 (diff) |
rototiller: pass num_cpus to .create_context()
Back in the day, there was no {create,destroy}_context(), so passing
num_cpus to just prepare_frame made sense. Modules then would
implicitly initialize themselves on the first prepare_frame() call
using a static initialized variable.
Since then things have been decomposed a bit for more sophisticated
(and cleaner) modules. It can be necessary to allocate per-cpu data
structures and the natural place to do that is @ create_context(). So
this commit wires that up.
A later commit will probably have to plumb a "current cpu" identifier
into the render_fragment() function. Because a per-cpu data structure
isn't particularly useful if you can't easily address it from within
your execution context.
Diffstat (limited to 'src/rototiller.c')
-rw-r--r-- | src/rototiller.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rototiller.c b/src/rototiller.c index 74ba006..a5d0927 100644 --- a/src/rototiller.c +++ b/src/rototiller.c @@ -416,13 +416,13 @@ int main(int argc, const char *argv[]) exit_if(!fps_setup(), "unable to setup fps counter"); - exit_if(rototiller.module->create_context && - !(rototiller.module_context = rototiller.module->create_context()), - "unable to create module context"); - pexit_if(!(rototiller.threads = threads_create()), "unable to create rendering threads"); + exit_if(rototiller.module->create_context && + !(rototiller.module_context = rototiller.module->create_context(threads_num_threads(rototiller.threads))), + "unable to create module context"); + pexit_if(pthread_create(&rototiller.thread, NULL, rototiller_thread, &rototiller) != 0, "unable to create dispatch thread"); |