From 51a8923eb33ad53a36271b1e0b3489d033178337 Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Thu, 9 May 2024 01:27:55 -0500 Subject: will push to unison --- main.cu | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'main.cu') diff --git a/main.cu b/main.cu index 9063a8f..2b1b180 100644 --- a/main.cu +++ b/main.cu @@ -1,6 +1,39 @@ -#include "include/helper_math.h" -__global__ void random_noise(double **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);//could move out of kernel for performance boost +#include +#include +#include +#include + +#include "raylib.h" + +__global__ void test_image(uint8_t *image); + +int main() { + const int size_x = 100; + const int size_y = 100; + uint8_t *image_d; + Image image = GenImageColor(size_x, size_y, BLUE); + SetTraceLogLevel(LOG_ERROR); + + InitWindow(size_x, size_y, "cuda teseteroni"); + + cudaMalloc((void **)&image_d, 100 * 100 * 4); + test_image<<<1, dim3(3,3)>>>(image_d); + cudaDeviceSynchronize(); + //for(;;); + //if(!IsWindowFullscreen()) ToggleFullscreen(); + + while(!WindowShouldClose()) { + cudaMemcpy(image.data, (void **)image_d, 100 * 100 * 4, cudaMemcpyDeviceToHost); + //memset(image.data, (int32_t)0x0000ff, 100 * 100 * 4); + BeginDrawing(); + DrawTexture(LoadTextureFromImage(image), 0, 0, WHITE); + EndDrawing(); + } + + + + + + return 0; } -- cgit v1.2.3