From 3249e0e65e7a9361eb3604d46496182fda9f83c0 Mon Sep 17 00:00:00 2001
From: Vito Caputo <vcaputo@pengaru.com>
Date: Sat, 9 Dec 2017 22:26:19 -0800
Subject: ray: add module context ray_context_t

Before I can clean up the ray_scene_t._prepared kludge I need a
place to keep state from frame prepare to render, enter context.

Future commits will migrate the _prepared stuff into a separate
ray_render_t which is constructed on prepare then acted on in
fragment render.

Then spatial acceleration structures may be added, constructed
at prepare phase and shared across the concurrent rendering.
---
 src/modules/ray/ray.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/modules/ray/ray.c b/src/modules/ray/ray.c
index 8688ad9..5f6326d 100644
--- a/src/modules/ray/ray.c
+++ b/src/modules/ray/ray.c
@@ -117,6 +117,22 @@ static ray_scene_t	scene = {
 static float	r;
 
 
+typedef struct ray_context_t {
+} ray_context_t;
+
+
+static void * ray_create_context(void)
+{
+	return calloc(1, sizeof(ray_context_t));
+}
+
+
+static void ray_destroy_context(void *context)
+{
+	free(context);
+}
+
+
 static int ray_fragmenter(void *context, const fb_fragment_t *fragment, unsigned num, fb_fragment_t *res_fragment)
 {
 	return fb_fragment_tile_single(fragment, 64, num, res_fragment);
@@ -165,6 +181,8 @@ static void ray_render_fragment(void *context, fb_fragment_t *fragment)
 
 
 rototiller_module_t	ray_module = {
+	.create_context = ray_create_context,
+	.destroy_context = ray_destroy_context,
 	.prepare_frame = ray_prepare_frame,
 	.render_fragment = ray_render_fragment,
 	.name = "ray",
-- 
cgit v1.2.3