From d28ceb85a6b43a503c608116798945baab0e060f Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 22 Apr 2017 15:29:49 -0700 Subject: *: add module context machinery introduces create_context() and destroy_context() methods, and adds a 'void *context' first parameter to the module methods. If a module doesn't supply create_context() then NULL is simply passed around as the context, so trivial modules can continue to only implement render_fragment(). A subsequent commit will update the modules to encapsulate their global state in module-specific contexts. --- src/rototiller.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/rototiller.h') diff --git a/src/rototiller.h b/src/rototiller.h index d1578fb..933f733 100644 --- a/src/rototiller.h +++ b/src/rototiller.h @@ -12,8 +12,10 @@ typedef struct rototiller_frame_t { } rototiller_frame_t; typedef struct rototiller_module_t { - void (*prepare_frame)(unsigned n_cpus, fb_fragment_t *fragment, rototiller_frame_t *res_frame); - void (*render_fragment)(fb_fragment_t *fragment); + void * (*create_context)(void); + void (*destroy_context)(void *context); + void (*prepare_frame)(void *context, unsigned n_cpus, fb_fragment_t *fragment, rototiller_frame_t *res_frame); + void (*render_fragment)(void *context, fb_fragment_t *fragment); char *name; char *description; char *author; -- cgit v1.2.1