From 11b1f27f9d27b3f497c20205a77f00272fe8f332 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 12 Feb 2017 00:08:10 +1300 Subject: Add rough, hard-coded mock-up to prove trampoline This needs the hard-coded constants taken out of it asap to merge with master. The code is strictly temporary as a measure to prove that the CL trampoline works and we are actually able to get images from the device. --- test.cl | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'test.cl') diff --git a/test.cl b/test.cl index cc587b4..5e081f5 100644 --- a/test.cl +++ b/test.cl @@ -1,5 +1,23 @@ -__kernel void test(__global float *a, __global float *b) +__kernel void fractal_gen(__global unsigned int *buffer) { - unsigned int i = get_global_id(0); - b[i] = a[i] * 2.f; + 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; + + float2 z = (0.0, 0.0); + + + for (i = 0; i < 254; i++) { + // if abs(z) > 2 + if (z.x*z.x + z.y*z.y > 4) + break; + + float oldx = z.x; + z.x = z.x*z.x - z.y*z.y + a; + z.y = 2*oldx*z.y + b; + } + buffer[x+1024*y] = i; } -- cgit v1.1