X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FTuto_Image_Cuda%2Fsrc%2Fcpp%2Fcore%2F01_Vague_smart%2Fmoo%2Fhost%2FVague.cu;fp=WCudaMSE%2FTuto_Image_Cuda%2Fsrc%2Fcpp%2Fcore%2F01_Vague_smart%2Fmoo%2Fhost%2FVague.cu;h=db72268ec224add3c323a6f0091f186a55da4d43;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/01_Vague_smart/moo/host/Vague.cu b/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/01_Vague_smart/moo/host/Vague.cu new file mode 100755 index 0000000..db72268 --- /dev/null +++ b/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/01_Vague_smart/moo/host/Vague.cu @@ -0,0 +1,133 @@ +#include +#include + +#include "Vague.h" +#include "Device.h" +#include "MathTools.h" + +using std::cout; +using std::endl; + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Imported *| + \*-------------------------------------*/ + +extern __global__ void vague(uchar4* ptrDevPixels,int w, int h,float t); + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* Implementation *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*-------------------------*\ + |* Constructeur *| + \*-------------------------*/ + +Vague::Vague(int w, int h,float dt) + { + // Inputs + this->w = w; + this->h = h; + this->dt=dt; + + // Tools + this->dg = dim3(8, 8, 1); // disons a optimiser + this->db = dim3(16, 16, 1); // disons a optimiser + this->t=0; + + //Outputs + this->title="[API Image Cuda] : Vague CUDA"; + + // Check: + //print(dg, db); + Device::assertDim(dg, db); + assert(w== h); + + cout << endl<<"[CBI] Vague dt =" << dt; + } + +Vague::~Vague() + { + // rien + } + +/*-------------------------*\ + |* Methode *| + \*-------------------------*/ + +/** + * Override + * Call periodicly by the API + */ +void Vague::animationStep() + { + t+=dt; + } + +/** + * Override + */ +void Vague::runGPU(uchar4* ptrDevPixels) + { + vague<<>>(ptrDevPixels,w,h,t); + } + +/*--------------*\ + |* get *| + \*--------------*/ + +/** + * Override + */ +float Vague::getT(void) + { + return t; + } + +/** + * Override + */ +int Vague::getW(void) + { + return w; + } + +/** + * Override + */ +int Vague::getH(void) + { + return h; + } + +/** + * Override + */ +string Vague::getTitle(void) + { + return title; + } + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/ +