This commit is contained in:
2016-01-15 15:07:38 -08:00
parent 7b25b1e845
commit 08fd8b2398
3 changed files with 37 additions and 59 deletions

View File

@@ -1,6 +1,6 @@
__kernel void conway_align(__read_only image2d_t front_image, __global unsigned char* back_image, __global int* num_workers, __global int* grid_width, __global int *grid_height)
__kernel void conway_align(__read_only image2d_t front_image, __global char* back_image, __global int* num_workers, __global int* grid_width, __global int *grid_height)
{
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
const sampler_t sampler=CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
// Caclulate the start and end range that this worker will be calculating
int data_length = *grid_width * *grid_height;
@@ -11,17 +11,10 @@ __kernel void conway_align(__read_only image2d_t front_image, __global unsigned
for (int i = start_range; i < end_range; i++){
int2 pixelcoord = (int2) (i % *grid_width, i / *grid_height);
int4 pixel;
pixel = read_imagei(front_image, sampler, pixelcoord);
uint4 pixel;
pixel = read_imageui(front_image, sampler, (int2)(i,get_global_id(0)));
if (pixel.w > 200){
back_image[i] = 0;
}
else
back_image[i] = 0;
back_image[i] = pixel.w / 255;
}
}