diff options
author | Aiden Gall <aiden@aidengall.xyz> | 2024-02-06 08:49:55 +0000 |
---|---|---|
committer | Aiden Gall <aiden@aidengall.xyz> | 2024-02-06 09:03:40 +0000 |
commit | 3b90152d969056682069254ddcdcc2d04148402b (patch) | |
tree | 260ca18b1489e603ca4594405cba6dc24457eb37 /src/spirt.c | |
parent | 71277d9af0a9c89ffeab47f01dcb1426f8ffa253 (diff) |
switch canvas to floating point rgb
Diffstat (limited to 'src/spirt.c')
-rw-r--r-- | src/spirt.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/spirt.c b/src/spirt.c index f9c6420..612c36e 100644 --- a/src/spirt.c +++ b/src/spirt.c @@ -51,9 +51,8 @@ struct camera { cl_float3 corner00; }; -static unsigned char *kernel_render(struct kernel_context *runtime, - size_t image_width, size_t image_height, - struct camera cam); +static float *kernel_render(struct kernel_context *runtime, size_t image_width, + size_t image_height, struct camera cam); static struct kernel_context kernel_context_init(size_t platidx, size_t devidx); static void kernel_context_clean(struct kernel_context *runtime); @@ -63,7 +62,7 @@ static struct opts get_args(int argc, char *argv[]); extern const char *SPIRV_START[]; extern const char *SPIRV_END[]; -static unsigned char * +static float * kernel_render(struct kernel_context *const runtime, const size_t image_width, const size_t image_height, const struct camera cam) { @@ -71,11 +70,11 @@ kernel_render(struct kernel_context *const runtime, const size_t image_width, size_t global_item_size[2]; - unsigned char *h_canvas; + float *h_canvas; cl_mem d_canvas, d_rays; size_t rays_size, canvas_size; - canvas_size = (sizeof("RGBA") - 1) * image_width * image_height; + canvas_size = (sizeof("RGB") - 1) * image_width * image_height; rays_size = 2 * image_width * image_height; d_rays = clCreateBuffer(runtime->context, CL_MEM_READ_WRITE, @@ -256,7 +255,7 @@ main(int argc, char *argv[]) struct opts opts; struct kernel_context runtime; - unsigned char *h_canvas; + float *h_canvas; struct camera cam; float focal_length, viewport_width, viewport_height; @@ -299,7 +298,7 @@ main(int argc, char *argv[]) img.data = h_canvas; img.width = opts.width; img.height = opts.height; - img.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8; + img.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32; img.mipmaps = 1; InitWindow(opts.width, opts.height, "spirt"); |