X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FTuto_Image_Cuda%2Fsrc%2Fcpp%2Fcore%2F01_Vague_smart%2Fmoo%2Fdevice%2FVagueDevice.cu;fp=WCudaMSE%2FTuto_Image_Cuda%2Fsrc%2Fcpp%2Fcore%2F01_Vague_smart%2Fmoo%2Fdevice%2FVagueDevice.cu;h=7d8112b8da651f5abb7cb91ab7e1ff7fee60fe27;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/01_Vague_smart/moo/device/VagueDevice.cu b/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/01_Vague_smart/moo/device/VagueDevice.cu new file mode 100755 index 0000000..7d8112b --- /dev/null +++ b/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/01_Vague_smart/moo/device/VagueDevice.cu @@ -0,0 +1,68 @@ +#include "Indice2D.h" +#include "IndiceTools.h" +#include "cudaTools.h" +#include "Device.h" + +#include "VagueMath.h" + +// Attention : Choix du nom est impotant! +// VagueDevice.cu et non Vague.cu +// Dans ce dernier cas, problème de linkage, car le nom du .cu est le meme que le nom d'un .cpp (host) +// On a donc ajouter Device (ou n'importequoi) pour que les noms soient différents! + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +__global__ void vague(uchar4* ptrDevPixels,int w, int h,float t); + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* Implementation *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +__global__ void vague(uchar4* ptrDevPixels, int w, int h, float t) + { + VagueMath vagueMath = VagueMath(w, h); + + const int TID = Indice2D::tid(); + const int NB_THREAD = Indice2D::nbThread(); + + const int WH=w*h; + + uchar4 color; + + int pixelI; + int pixelJ; + + int s = TID; + while (s < WH) + { + IndiceTools::toIJ(s, w, &pixelI, &pixelJ); // update (pixelI, pixelJ) + + vagueMath.colorIJ(&color,pixelI, pixelJ, t); // update color + ptrDevPixels[s] = color; + + s += NB_THREAD; + } + } + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/ +