summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAiden Gall <aiden@aidengall.xyz>2024-02-06 09:05:42 +0000
committerAiden Gall <aiden@aidengall.xyz>2024-02-06 09:05:42 +0000
commitaee4cbae83d93f5bd04470b784afd2c262be9844 (patch)
tree879a378527d3cb7c4879ee270987fa4aa53e8add
parent3b90152d969056682069254ddcdcc2d04148402b (diff)
refactor gen_rays
-rw-r--r--src/cl/spirt.cl11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cl/spirt.cl b/src/cl/spirt.cl
index f55aa74..1fe7bd0 100644
--- a/src/cl/spirt.cl
+++ b/src/cl/spirt.cl
@@ -35,18 +35,19 @@ gen_rays(__global float3 *const rays, const float3 camera_centre,
const float3 pixel_delta_u, const float3 pixel_delta_v,
const float3 corner00)
{
- size_t idx, w, i, j;
+ __global float3 *ray;
+ size_t w, i, j;
w = get_global_size(0);
i = get_global_id(0);
j = get_global_id(1);
- idx = (w * j + i) * 2;
+ ray = rays + 2 * (w * j + i);
- rays[idx] = camera_centre;
- rays[idx + 1] = corner00 + ((i * pixel_delta_u) + (j * pixel_delta_v)) -
- camera_centre;
+ ray[0] = camera_centre;
+ ray[1] = corner00 + ((i * pixel_delta_u) + (j * pixel_delta_v)) -
+ camera_centre;
}
static float