From feaa057e0d53f39dd4e8d5bbc5a00b2c7f6d8400 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Jul 21 2018 18:45:33 +0000 Subject: contourgl: cl optimize4 --- diff --git a/c++/contourgl/cl/contour-base.cl b/c++/contourgl/cl/contour-base.cl index d359393..a29a829 100644 --- a/c++/contourgl/cl/contour-base.cl +++ b/c++/contourgl/cl/contour-base.cl @@ -15,6 +15,8 @@ along with this program. If not, see . */ +#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable + #define ONE 65536 #define TWO 131072 // (ONE)*2 #define HALF 32768 // (ONE)/2 @@ -59,7 +61,7 @@ kernel void path( float kx = d.x/d.y; float ky = d.y/d.x; - global int *row, *mark; + global int *row; float2 px, py, pp1; float cover, area; int ix, iy, iix; @@ -84,9 +86,7 @@ kernel void path( ix = clamp(ix, 0, w1); row = mark_buffer + 4*iy*width; - mark = row + 4*ix; - atomic_add(mark, (int)(area*cover)); - atomic_add(mark + 1, (int)cover); + atomic_add((global long*)(row + 4*ix), upsample((int)cover, (int)(area*cover))); row += 2; iix = (ix & (ix + 1)) - 1;