summaryrefslogtreecommitdiff
path: root/src/cl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cl')
-rw-r--r--src/cl/spirt.cl9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cl/spirt.cl b/src/cl/spirt.cl
index 943f317..f55aa74 100644
--- a/src/cl/spirt.cl
+++ b/src/cl/spirt.cl
@@ -68,19 +68,18 @@ hit_sphere(const float3 center, const float radius, const struct ray ray)
}
void
-write_pixel(__global uchar *const pixel, float3 colour)
+write_pixel(__global float *const pixel, float3 colour)
{
/* gamma correction */
- colour = 256.0f * clamp(pow(colour, 1.0f/2.2f), 0.0f, 0.999f);
+ colour = clamp(pow(colour, 1.0f / 2.2f), 0.0f, 1.0f);
pixel[0] = colour.x;
pixel[1] = colour.y;
pixel[2] = colour.z;
- pixel[3] = 255;
}
__kernel void
-ray_colour(__global uchar *const canvas, __global const float3 *const rays)
+ray_colour(__global float *const canvas, __global const float3 *const rays)
{
struct ray ray;
@@ -114,5 +113,5 @@ ray_colour(__global uchar *const canvas, __global const float3 *const rays)
colour = (1.0f - a) * 1.0f + a * (float3)(0.5f, 0.7f, 1.0f);
}
- write_pixel(canvas + 4 * (w * j + i), colour);
+ write_pixel(canvas + 3 * (w * j + i), colour);
}