Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00022 #if defined(CL_SIFTGPU_ENABLED)
00023
00024 #ifndef CL_TEX_IMAGE_H
00025 #define CL_TEX_IMAGE_H
00026
00027 class GLTexImage;
00028
00029 class CLTexImage
00030 {
00031 protected:
00032 cl_context _context;
00033 cl_command_queue _queue;
00034 cl_mem _clData;
00035 int _numChannel;
00036 int _imgWidth;
00037 int _imgHeight;
00038 int _texWidth;
00039 int _texHeight;
00040 int _bufferLen;
00041 int _fromGL;
00042 private:
00043 void ReleaseTexture();
00044 public:
00045 void SetImageSize(int width, int height);
00046 void SetPackedSize(int width, int height, int packed);
00047 void InitBufferTex(int width, int height, int nchannel);
00048 void InitTexture(int width, int height, int nchannel);
00049 void InitPackedTex(int width, int height, int packed);
00050 void InitTextureGL(GLuint tex, int width, int height, int nchannel);
00051 void CopyToHost(void* buf);
00052 void CopyFromHost(const void* buf);
00053 public:
00054 int CopyToPBO(GLuint pbo);
00055 int GetImageDataSize();
00056 public:
00057 inline operator cl_mem(){return _clData; }
00058 inline int GetImgWidth(){return _imgWidth;}
00059 inline int GetImgHeight(){return _imgHeight;}
00060 inline int GetTexWidth(){return _texWidth;}
00061 inline int GetTexHeight(){return _texHeight;}
00062 inline int GetDataSize(){return _bufferLen;}
00063 inline bool IsImage2D() {return _bufferLen == 0;}
00064 inline int GetImgPixelCount(){return _imgWidth*_imgHeight;}
00065 inline int GetTexPixelCount(){return _texWidth*_texHeight;}
00066 public:
00067 CLTexImage();
00068 CLTexImage(cl_context context, cl_command_queue queue);
00069 void SetContext(cl_context context, cl_command_queue queue);
00070 virtual ~CLTexImage();
00071 friend class ProgramCL;
00072 friend class PyramidCL;
00073 friend class ProgramBagCL;
00074 friend class ProgramBagCLN;
00075 };
00076
00078
00079
00080 #endif // !defined(CU_TEX_IMAGE_H)
00081 #endif
00082
00083