10 #include "RayTracingProvider.h"
11 #include "RayTracingParams.h"
13 /*----------------------------------------------------------------------*\
15 \*---------------------------------------------------------------------*/
17 /*--------------------------------------*\
19 \*-------------------------------------*/
21 extern int rippling0FreeGL(int itmax
); // bas technique
23 /*--------------------------------------*\
25 \*-------------------------------------*/
29 /*--------------------------------------*\
31 \*-------------------------------------*/
33 /*----------------------------------------------------------------------*\
35 \*---------------------------------------------------------------------*/
37 void run(uchar4
* ptrDevPixels
, int dw
, int dh
, int dg
, int db
, int nbFrame
)
39 cout
<< "Raytracing Without GL ";
40 #if CURRENT_MEMORY_MODEL == MEMORY_MODEL_GLOBAL
41 cout
<< "(Global memory)" << endl
;
42 #elif CURRENT_MEMORY_MODEL == MEMORY_MODEL_CONSTANT
43 cout
<< "(Constant memory)" << endl
;
44 #elif CURRENT_MEMORY_MODEL == MEMORY_MODEL_SHARED
45 cout
<< "(Shared memory)" << endl
;
48 cout
<< "Nb frames: " << nbFrame
<< endl
;
50 RayTracing
* rayTracing
= RayTracingProvider::create(dw
, dh
, dg
, db
);
55 for (int i
= 0; i
< nbFrame
; i
++)
56 rayTracing
->runGPU(ptrDevPixels
);
58 HANDLE_ERROR(cudaDeviceSynchronize());
62 cout
<< "Time: " << chronos
<< endl
;
63 cout
<< "-------------------" << endl
;
66 /*--------------------------------------*\
68 \*-------------------------------------*/
72 const int NB_FRAME_TO_RENDER
= 100;
73 const int dw
= 16 * 50;
74 const int dh
= 16 * 50;
77 const int dgStart
= 8;
78 const int dgStop
= 128;
81 const int dbStart
= 8;
82 const int dbStop
= 32;
85 HANDLE_ERROR(cudaMalloc(&ptrDevPixels
, dw
* dh
* sizeof(uchar4
)));
87 run(ptrDevPixels
, dw
, dh
, 32, 32, NB_FRAME_TO_RENDER
);
90 for (int dg
= dgStart
; dg
<= dgStop
; dg
*= 2)
91 for (int db
= dbStart
; db
<= dbStop
; db
*= 2)
92 run(ptrDevPixels
, dw
, dh
, dg
, db
, NB_FRAME_TO_RENDER
);
97 /*--------------------------------------*\
99 \*-------------------------------------*/
101 /*----------------------------------------------------------------------*\
103 \*---------------------------------------------------------------------*/