diff options
author | Jan Vesely <jan vesely rutgers edu> | 2014-06-14 11:58:10 +0200 |
---|---|---|
committer | Sven Claussner <sclaussner@src.gnome.org> | 2014-06-19 19:38:05 +0200 |
commit | 3a2c433f84e80dbb854565341e81e837edc90649 (patch) | |
tree | d59b55ff80a72bc6c975fdc5d0503669a8cf4c59 /opencl | |
parent | bb271c3200a69504076a0e0143369656c0788a5f (diff) |
OpenCl: Make noise-simplex kernel OpenCL 1.1 compliant
Makes the op run on mesa/clover.
No static keyword, f suffix for float constants
Fixes one error and 7 warnings
Signed-off-by: Jan Vesely <jan vesely rutgers edu>
Diffstat (limited to 'opencl')
-rw-r--r-- | opencl/noise-simplex.cl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/opencl/noise-simplex.cl b/opencl/noise-simplex.cl index bb597587..ce8aa401 100644 --- a/opencl/noise-simplex.cl +++ b/opencl/noise-simplex.cl @@ -1,6 +1,6 @@ #define MAX_RANK 3 -static float2 +float2 philox (uint2 st, uint k) { @@ -17,7 +17,7 @@ philox (uint2 st, k += 0x9e3779b9u; } - return convert_float2(st) / 2147483648.0 - 1.0; + return convert_float2(st) / 2147483648.0f - 1.0f; } __kernel void kernel_noise (__global float *out, @@ -47,19 +47,19 @@ __kernel void kernel_noise (__global float *out, /* Skew the input point and find the lowest corner of the containing simplex. */ - s = (p.x + p.y) * (sqrt(3.0) - 1) / 2; + s = (p.x + p.y) * (sqrt(3.0f) - 1) / 2; i = floor(p + s); /* Calculate the (unskewed) distance between the input point and all simplex corners. */ - s = (i.x + i.y) * (3 - sqrt(3.0)) / 6; + s = (i.x + i.y) * (3 - sqrt(3.0f)) / 6; u[0] = p - i + s; di = u[0].x >= u[0].y ? (float2)(1, 0) : (float2)(0, 1); - u[1] = u[0] - di + (3 - sqrt(3.0)) / 6; - u[2] = u[0] - 1 + (3 - sqrt(3.0)) / 3; + u[1] = u[0] - di + (3 - sqrt(3.0f)) / 6; + u[2] = u[0] - 1 + (3 - sqrt(3.0f)) / 3; /* Calculate gradients for each corner vertex. We convert to * signed int first to avoid implementation-defined behavior for @@ -72,7 +72,7 @@ __kernel void kernel_noise (__global float *out, for (k = 0, n = 0 ; k < 3 ; k += 1) { - t = 0.5 - dot(u[k], u[k]); + t = 0.5f - dot(u[k], u[k]); if (t > 0) { |