From aee4cbae83d93f5bd04470b784afd2c262be9844 Mon Sep 17 00:00:00 2001 From: Aiden Gall Date: Tue, 6 Feb 2024 09:05:42 +0000 Subject: refactor gen_rays --- src/cl/spirt.cl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') 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 -- cgit v1.2.3