diff options
Diffstat (limited to 'kernel.cu')
-rw-r--r-- | kernel.cu | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel.cu b/kernel.cu new file mode 100644 index 0000000..c00056a --- /dev/null +++ b/kernel.cu @@ -0,0 +1,18 @@ +#include <curand.h> +#include <stdint.h> +#include <stdio.h> +#include "include/helper_math.h" + +__global__ void test_image(uint8_t *image) { + int2 unnormalized_coordinates = make_int2(blockDim.x, blockDim.y) * make_int2(blockIdx.x, blockIdx.y) + make_int2(threadIdx.x, threadIdx.y); + int2 img_res = make_int2(blockDim.x, blockDim.y) * make_int2(gridDim.x, gridDim.y); + size_t img_index = (unnormalized_coordinates.y * img_res.y) + unnormalized_coordinates.x; + //uint8_t pixel_val = (img_index / (img_res.x * img_res.y)) * 255; + uint8_t pixel_val = 0xff; + //if(img_index == 1) printf("%i\n", img_index); + print(img_index) + image[img_index] = 0xff; + image[img_index+1] = pixel_val; + image[img_index+2] = pixel_val; + image[img_index+3] = 0xff; +} |