summaryrefslogtreecommitdiff
path: root/src/til.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-01-10 15:09:29 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-01-10 23:50:57 -0800
commit19966a5cb3a8d9cf8edbae225953da042dadfa96 (patch)
treefd041758fb8f7301d2d699faa420ea80d5fc08e0 /src/til.h
parentcffc3da34523b996393f730bed5a65934b499167 (diff)
*: introduce paths for module contexts
There needs to be a way to address module context instances by name externally, in a manner complementary to settings and taps. This commit adds a string-based path to til_module_context_t, and modifies til_module_create_context() to accept a parent path which is then concatenated with the name of the module to produce the module instance's new path. The name separator used in the paths is '/' just like filesystem paths, but these paths have no relationship to filesystems or files. The root module context creation in rototiller's main simply passes "" as the parent path, resulting in a "/" root as one would expect. There are some obvious complications introduced here however: - checkers in particular creates a context per cpu, simply using the same seed and setup to try make the contexts identical at the same ticks value. With this commit I'm simply passing the incoming path as the parent for creating those contexts, but it's unclear to me if that will work OK. With an eye towards taps deriving their parent path from the context path, I guess these taps would all get the same parent and hash to the same value despite being duplicated. Maybe it Just Works, but one thing is clear - there won't be any way to address the per-cpu taps as-is. Maybe that's desirable though, there's probably not much use in trying to control the taps at the CPU granularity. - when the recursive settings stuff lands, it should bring along the ability to explicitly name settings blocks. Those names should override the module name in constructing the path. I've noted as such in the code. - these paths probably need to be hashed @ initialization time so there needs to be a hash function added to til, and a hash value accompanying the name in the module context. It'd be dumb to keep recomputing the hash when these paths get used for hash table lookups multiple times per frame... there's probably more I'm forgetting right now, but this seems like a good first step. fixup root path
Diffstat (limited to 'src/til.h')
-rw-r--r--src/til.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/til.h b/src/til.h
index 5d19ea7..852cb96 100644
--- a/src/til.h
+++ b/src/til.h
@@ -22,7 +22,7 @@ typedef struct til_knob_t til_knob_t;
#define TIL_MODULE_OVERLAYABLE 1u
typedef struct til_module_t {
- til_module_context_t * (*create_context)(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup);
+ til_module_context_t * (*create_context)(unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup);
void (*destroy_context)(til_module_context_t *context);
void (*prepare_frame)(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan);
void (*render_fragment)(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr);
@@ -41,7 +41,7 @@ void til_shutdown(void);
const til_module_t * til_lookup_module(const char *name);
void til_get_modules(const til_module_t ***res_modules, size_t *res_n_modules);
void til_module_render(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr);
-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 * til_module_destroy_context(til_module_context_t *context);
int til_module_setup(til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup);
int til_module_randomize_setup(const til_module_t *module, unsigned seed, til_setup_t **res_setup, char **res_arg);
© All Rights Reserved