X-Git-Url: http://git.euphorik.ch/?p=GPU.git;a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F04_RayTracing%2Fmoo%2Fhost%2FRayTracing.cu;h=fbbd16073f32e06358914b8ae3ca3a775eb5cd84;hp=874269272730f12e40768e817ed1a1db76427109;hb=1c4b2276e7157acde9a3014b68d5d1667a7d6a44;hpb=f8259dce248a4411c3bc64cecb9fc268c4fd81d6 diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/04_RayTracing/moo/host/RayTracing.cu b/WCudaMSE/Student_Cuda_Image/src/cpp/core/04_RayTracing/moo/host/RayTracing.cu index 8742692..fbbd160 100644 --- a/WCudaMSE/Student_Cuda_Image/src/cpp/core/04_RayTracing/moo/host/RayTracing.cu +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/04_RayTracing/moo/host/RayTracing.cu @@ -9,12 +9,12 @@ using namespace std; #include "Device.h" #include "RayTracingDevice.h" #include "Sphere.h" -#include "RayTracingCommon.h" +#include "RayTracingParams.h" -RayTracing::RayTracing(int w, int h) : +RayTracing::RayTracing(int w, int h, int dg, int db) : t(0), w(w), h(h), - dg(8, 8, 1), - db(32, 32, 1), + dg(dg, dg, 1), + db(db, db, 1), alea(42), #if CURRENT_MEMORY_MODEL == MEMORY_MODEL_GLOBAL title("Ray Tracing (Global memory)") @@ -27,6 +27,11 @@ RayTracing::RayTracing(int w, int h) : Device::assertDim(dg, db); Sphere* spheres = this->createSpheres(NB_SPHERES); + cout << "sizeof(Sphere): " << sizeof(Sphere) << endl; + cout << "Nb of spheres: " << NB_SPHERES << endl; + cout << "sizeof(spheres): " << NB_SPHERES * sizeof(Sphere) << endl; + cout << "dg: " << this->dg.x << " x " << this->dg.y << endl; + cout << "db: " << this->db.x << " x " << this->db.y << endl; #if CURRENT_MEMORY_MODEL == MEMORY_MODEL_GLOBAL or CURRENT_MEMORY_MODEL == MEMORY_MODEL_SHARED // Copie des spheres dans la global memory. @@ -51,12 +56,12 @@ RayTracing::~RayTracing() void RayTracing::runGPU(uchar4* ptrDevPixels) { #if CURRENT_MEMORY_MODEL == MEMORY_MODEL_GLOBAL or CURRENT_MEMORY_MODEL == MEMORY_MODEL_SHARED - rayTracing<<>>(ptrDevPixels, this->ptrDevSpheres, this->w, this->h, this->t); + rayTracing<<>>(ptrDevPixels, this->ptrDevSpheres, this->w, this->h, this->t); #elif CURRENT_MEMORY_MODEL == MEMORY_MODEL_CONSTANT - rayTracing<<>>(ptrDevPixels, this->w, this->h, this->t); + rayTracing<<>>(ptrDevPixels, this->w, this->h, this->t); #endif - HANDLE_ERROR(cudaDeviceSynchronize()); // Pour flusher les 'printf' (pour le DEBUG). + // HANDLE_ERROR(cudaDeviceSynchronize()); // Pour flusher les 'printf' (pour le DEBUG). } void RayTracing::animationStep()