#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)")
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.
void RayTracing::runGPU(uchar4* ptrDevPixels)
{
#if CURRENT_MEMORY_MODEL == MEMORY_MODEL_GLOBAL or CURRENT_MEMORY_MODEL == MEMORY_MODEL_SHARED
- rayTracing<<<dg,db>>>(ptrDevPixels, this->ptrDevSpheres, this->w, this->h, this->t);
+ rayTracing<<<dg, db>>>(ptrDevPixels, this->ptrDevSpheres, this->w, this->h, this->t);
#elif CURRENT_MEMORY_MODEL == MEMORY_MODEL_CONSTANT
- rayTracing<<<dg,db>>>(ptrDevPixels, this->w, this->h, this->t);
+ rayTracing<<<dg, db>>>(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()