summaryrefslogtreecommitdiff
path: root/src/til.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/til.c')
-rw-r--r--src/til.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/til.c b/src/til.c
index f7e3225..9435e28 100644
--- a/src/til.c
+++ b/src/til.c
@@ -223,23 +223,40 @@ void til_module_render(til_module_context_t *context, unsigned ticks, til_fb_fra
* the purpose of explicitly constraining rendering parallelization to less than n_threads,
* if n_cpus is specified > n_threads it won't increase n_threads...
*/
-int til_module_create_context(const til_module_t *module, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup, til_module_context_t **res_context)
+int til_module_create_context(const til_module_t *module, unsigned seed, unsigned ticks, unsigned n_cpus, const char *parent_path, til_setup_t *setup, til_module_context_t **res_context)
{
til_module_context_t *context;
+ char *path;
assert(module);
+ assert(parent_path);
assert(res_context);
+ {
+ size_t path_len;
+
+ /* TODO: when til_setup_t learns to name settings blocks, this would be where to override module->name with the setup-specified name */
+ path_len = strlen(parent_path) + 1 + strlen(module->name) + 1;
+ path = calloc(1, path_len);
+ if (!path)
+ return -ENOMEM;
+
+ snprintf(path, path_len, "%s/%s", parent_path, module->name);
+ }
+
if (!n_cpus)
n_cpus = til_threads_num_threads(til_threads);
if (!module->create_context)
- context = til_module_context_new(sizeof(til_module_context_t), seed, ticks, n_cpus);
+ context = til_module_context_new(sizeof(til_module_context_t), seed, ticks, n_cpus, path);
else
- context = module->create_context(seed, ticks, n_cpus, setup);
+ context = module->create_context(seed, ticks, n_cpus, path, setup);
+
+ if (!context) {
+ free(path);
- if (!context)
return -ENOMEM;
+ }
context->module = module;
© All Rights Reserved