diff --git a/examples/demo_mandelbrot.py b/examples/demo_mandelbrot.py index 45fd74e59af36e675e99851c22507bc07e8f4057..4919dbb086c8bd2fd1f8ff431b420e90ecf1286e 100644 --- a/examples/demo_mandelbrot.py +++ b/examples/demo_mandelbrot.py @@ -41,6 +41,7 @@ def calc_fractal_opencl(q, maxiter): output_opencl = cl.Buffer(ctx, mf.WRITE_ONLY, output.nbytes) prg = cl.Program(ctx, """ + #pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable __kernel void mandelbrot(__global float2 *q, __global ushort *output, ushort const maxiter) { @@ -51,11 +52,11 @@ def calc_fractal_opencl(q, maxiter): output[gid] = 0; for(int curiter = 0; curiter < maxiter; curiter++) { - nreal = real*real - imag*imag + q[gid][0]; - imag = 2* real*imag + q[gid][1]; + nreal = real*real - imag*imag + q[gid].x; + imag = 2* real*imag + q[gid].y; real = nreal; - if (real*real + imag*imag > 4.) + if (real*real + imag*imag > 4.0f) output[gid] = curiter; } }