diff options
Diffstat (limited to 'test.cl')
-rw-r--r-- | test.cl | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1,16 +1,19 @@ -__kernel void fractal_gen(__global unsigned int *buffer) +__kernel void fractal_gen( + __global unsigned char *buffer, + const unsigned int size, + const unsigned int iterations) { unsigned int x = get_global_id(0); unsigned int y = get_global_id(1); unsigned int i = 0; - float a = -2.5+(((float)x)/(float)1024)*3.5; - float b = -1.75+(((float)y)/(float)1024)*3.5; + float a = -2.5+(((float)x)/(float)size)*3.5; + float b = -1.75+(((float)y)/(float)size)*3.5; float2 z = (0.0, 0.0); - for (i = 0; i < 254; i++) { + for (i = 0; i < iterations; i++) { // if abs(z) > 2 if (z.x*z.x + z.y*z.y > 4) break; @@ -19,5 +22,5 @@ __kernel void fractal_gen(__global unsigned int *buffer) z.x = z.x*z.x - z.y*z.y + a; z.y = 2*oldx*z.y + b; } - buffer[x+1024*y] = i; + buffer[x+size*y] = (i*255)/iterations; } |