Basic Image AlgorithmS Library
2.8.0
|
OpenCL Buffer wrapper. More...
#include <OpenCLFramework/clfBuffer.hh>
Public Member Functions | |
void | Allocate (unsigned int bufsize, bool readonly=false, bool writeonly=false, void *hostptr=NULL, bool copy=false) |
Allocation of a memory buffer A memory buffer can be created on device or host, it can be initialized from a host ptr. More... | |
void | Allocate (unsigned int rows, unsigned int cols, unsigned int channels, unsigned int itemsize, bool readonly=false, bool writeonly=false, void *hostptr=NULL, bool copy=false) |
void | AllocateFromVertexBuffer (BIAS::glfVertexBuffer &vbo, bool readonly=false, bool writeonly=false) |
Allocation of a memory buffer from a GL vertexBuffer (works only on shared context!) More... | |
void | CopyBuffer (clfBuffer &outputbuffer, unsigned int srcoffset=0, unsigned int dstoffset=0, unsigned int size=0) |
copy from one buffer to another More... | |
unsigned int | GetChannels () const |
unsigned int | GetCols () const |
unsigned int | GetItemSize () const |
unsigned int | GetRows () const |
unsigned int | GetStride () const |
unsigned int | GLId () |
bool | Initialized () |
bool | IsReadOnly () |
bool | IsSharedGL () |
bool | IsWriteOnly () |
void * | MapBuffer (bool write=false, unsigned int offset=0, unsigned int size=0) |
void | ReadFromBuffer (void *data, unsigned int offset=0, unsigned int size=0) |
read from buffer object to host memory More... | |
void | SetCached (bool cache) |
unsigned int | Size () |
void | UnMap (void *data) |
void | WriteToBuffer (const void *data, unsigned int offset=0, unsigned int size=0) |
write from host memory to buffer object More... | |
virtual | ~clfBuffer () |
Protected Member Functions | |
cl::Buffer & | buffer () |
clfBuffer (cl::Context *context, cl::CommandQueue *queue_) | |
int | DetermineMemFlags_ (bool readonly, bool writeonly, const void *hostptr=NULL, bool copy=false) |
cl::Memory & | memory () |
Protected Attributes | |
cl::Memory | buffer_ |
cl::Context * | context_ |
unsigned int | glid_ |
bool | initialized_ |
cl::CommandQueue * | queue_ |
bool | sharedGL_ |
unsigned int | size_ |
Friends | |
class | clfContext |
class | clfProgram |
OpenCL Buffer wrapper.
An clfBuffer is used for Buffers both host and GL objects. All buffers are created from a valid clfContext, hence the constructor is protected.
Definition at line 43 of file clfBuffer.hh.
|
virtual |
Definition at line 41 of file clfBuffer.cpp.
|
protected |
Definition at line 32 of file clfBuffer.cpp.
void clfBuffer::Allocate | ( | unsigned int | bufsize, |
bool | readonly = false , |
||
bool | writeonly = false , |
||
void * | hostptr = NULL , |
||
bool | copy = false |
||
) |
Allocation of a memory buffer A memory buffer can be created on device or host, it can be initialized from a host ptr.
if the buffer is not readonly and not writeonly it is declared read/write.
bufsize | size of buffer in byte |
readonly | if this buffer is read only |
writeonly | if this buffer is write only |
hostptr | ptr to host memory which is used for initialization (if NULL, do not initialize) |
copy | copy host ptr data to device or use host memory |
Definition at line 45 of file clfBuffer.cpp.
References BIAS::clfMemory::buffer_, BIAS::clfMemory::context_, BIAS::clfMemory::DetermineMemFlags_(), BIAS::clfMemory::initialized_, BIAS::clfMemory::sharedGL_, and BIAS::clfMemory::size_.
Referenced by BIAS::clfRadixSort::clfRadixSort(), and BIAS::clfTrimmedICP::clfTrimmedICP().
void clfBuffer::Allocate | ( | unsigned int | rows, |
unsigned int | cols, | ||
unsigned int | channels, | ||
unsigned int | itemsize, | ||
bool | readonly = false , |
||
bool | writeonly = false , |
||
void * | hostptr = NULL , |
||
bool | copy = false |
||
) |
Definition at line 61 of file clfBuffer.cpp.
References BIAS::clfMemory::buffer_, BIAS::clfMemory::context_, BIAS::clfMemory::DetermineMemFlags_(), BIAS::clfMemory::initialized_, BIAS::clfMemory::sharedGL_, and BIAS::clfMemory::size_.
void clfBuffer::AllocateFromVertexBuffer | ( | BIAS::glfVertexBuffer & | vbo, |
bool | readonly = false , |
||
bool | writeonly = false |
||
) |
Allocation of a memory buffer from a GL vertexBuffer (works only on shared context!)
Definition at line 96 of file clfBuffer.cpp.
References BIAS::clfMemory::buffer_, BIAS::clfMemory::context_, BIAS::clfMemory::DetermineMemFlags_(), BIAS::glfVertexBuffer::GetBufferID(), BIAS::glfVertexBuffer::GetFormat(), BIAS::glfVertexBuffer::GetNumVertices(), BIAS::glfVertexFormat::GetVertexSize(), BIAS::clfMemory::glid_, BIAS::clfMemory::initialized_, BIAS::clfMemory::sharedGL_, and BIAS::clfMemory::size_.
Referenced by BIAS::clfTrimmedICP::SetDataFromDepthMap(), and BIAS::clfTrimmedICP::SetModelFromDepthMap().
|
protected |
Definition at line 113 of file clfBuffer.cpp.
References BIAS::clfMemory::buffer_.
Referenced by CopyBuffer(), BIAS::clfProgram::KernelSetArgument(), MapBuffer(), ReadFromBuffer(), and WriteToBuffer().
void clfBuffer::CopyBuffer | ( | clfBuffer & | outputbuffer, |
unsigned int | srcoffset = 0 , |
||
unsigned int | dstoffset = 0 , |
||
unsigned int | size = 0 |
||
) |
copy from one buffer to another
outputbuffer | buffer object (to) |
size | number of bytes to copy |
Definition at line 139 of file clfBuffer.cpp.
References buffer(), BIAS::clfMemory::queue_, and BIAS::clfMemory::size_.
Referenced by BIAS::clfRadixSort::SetData().
|
protectedinherited |
Definition at line 73 of file clfMemory.cpp.
Referenced by BIAS::clfImage3D::Allocate(), BIAS::clfImage2D::Allocate(), Allocate(), BIAS::clfImage2D::AllocateFromTexture2D(), BIAS::clfImage3D::AllocateFromTexture3D(), and AllocateFromVertexBuffer().
unsigned int clfBuffer::GetChannels | ( | ) | const |
Definition at line 183 of file clfBuffer.cpp.
unsigned int clfBuffer::GetCols | ( | ) | const |
Definition at line 173 of file clfBuffer.cpp.
unsigned int clfBuffer::GetItemSize | ( | ) | const |
Definition at line 176 of file clfBuffer.cpp.
unsigned int clfBuffer::GetRows | ( | ) | const |
Definition at line 170 of file clfBuffer.cpp.
unsigned int clfBuffer::GetStride | ( | ) | const |
Definition at line 179 of file clfBuffer.cpp.
|
inherited |
Definition at line 47 of file clfMemory.cpp.
References BIAS::clfMemory::glid_, and BIAS::clfMemory::sharedGL_.
|
inlineinherited |
Definition at line 37 of file clfMemory.hh.
|
inherited |
Definition at line 62 of file clfMemory.cpp.
References BIAS::clfMemory::buffer_.
Referenced by BIAS::clfRecursiveGauss::FilterGrey(), and BIAS::clfRecursiveGauss::FilterGreyColPacked().
|
inlineinherited |
Definition at line 38 of file clfMemory.hh.
Referenced by BIAS::clfColorConversion::RGBAToPackedGrey(), BIAS::clfColorConversion::RGBToGrey(), and BIAS::clfImage2D::SetStorageAndColorModelInfo().
|
inherited |
Definition at line 67 of file clfMemory.cpp.
References BIAS::clfMemory::buffer_.
void * clfBuffer::MapBuffer | ( | bool | write = false , |
unsigned int | offset = 0 , |
||
unsigned int | size = 0 |
||
) |
Definition at line 152 of file clfBuffer.cpp.
References buffer(), BIAS::clfMemory::queue_, and BIAS::clfMemory::size_.
Referenced by BIAS::clfTrimmedICP::ComputeNearestPoints_(), and BIAS::clfTrimmedICP::ComputeOptimalMotion_().
|
protectedinherited |
Definition at line 43 of file clfMemory.cpp.
References BIAS::clfMemory::buffer_.
Referenced by BIAS::clfContext::AcquireGLObject(), BIAS::clfContext::ReleaseGLObject(), and BIAS::clfMemory::UnMap().
void clfBuffer::ReadFromBuffer | ( | void * | data, |
unsigned int | offset = 0 , |
||
unsigned int | size = 0 |
||
) |
read from buffer object to host memory
data | host memory pointer |
offset | offset in bytes |
size | number of bytes to read |
Definition at line 128 of file clfBuffer.cpp.
References buffer(), BIAS::clfMemory::queue_, and BIAS::clfMemory::size_.
Referenced by BIAS::clfRadixSort::GetPermutation(), and BIAS::clfRadixSort::RecupGPU().
void clfBuffer::SetCached | ( | bool | cache | ) |
Definition at line 109 of file clfBuffer.cpp.
|
inlineinherited |
Definition at line 40 of file clfMemory.hh.
|
inherited |
Definition at line 54 of file clfMemory.cpp.
References BIAS::clfMemory::memory(), and BIAS::clfMemory::queue_.
Referenced by BIAS::clfTrimmedICP::ComputeNearestPoints_(), BIAS::clfTrimmedICP::ComputeOptimalMotion_(), and BIAS::clfImage2D::CopyToBiasImageUncheckedRGBAToRGB().
void clfBuffer::WriteToBuffer | ( | const void * | data, |
unsigned int | offset = 0 , |
||
unsigned int | size = 0 |
||
) |
write from host memory to buffer object
data | host memory pointer |
offset | offset in bytes |
size | number of bytes to write |
Definition at line 117 of file clfBuffer.cpp.
References buffer(), BIAS::clfMemory::queue_, and BIAS::clfMemory::size_.
Referenced by BIAS::clfRadixSort::Host2GPU(), BIAS::clfRadixSort::Resize(), and BIAS::clfRadixSort::SetData().
|
friend |
Definition at line 102 of file clfBuffer.hh.
|
friend |
Definition at line 103 of file clfBuffer.hh.
|
protectedinherited |
Definition at line 56 of file clfMemory.hh.
Referenced by BIAS::clfImage3D::Allocate(), BIAS::clfImage2D::Allocate(), Allocate(), BIAS::clfImage2D::AllocateFromTexture2D(), BIAS::clfImage3D::AllocateFromTexture3D(), AllocateFromVertexBuffer(), buffer(), BIAS::clfImage3D::image(), BIAS::clfImage2D::image(), BIAS::clfMemory::IsReadOnly(), BIAS::clfMemory::IsWriteOnly(), and BIAS::clfMemory::memory().
|
protectedinherited |
Definition at line 54 of file clfMemory.hh.
Referenced by BIAS::clfImage3D::Allocate(), BIAS::clfImage2D::Allocate(), Allocate(), BIAS::clfImage2D::AllocateFromTexture2D(), BIAS::clfImage3D::AllocateFromTexture3D(), AllocateFromVertexBuffer(), BIAS::clfImage2D::clfImage2D(), BIAS::clfImage3D::clfImage3D(), and BIAS::clfMemory::clfMemory().
|
protectedinherited |
Definition at line 61 of file clfMemory.hh.
Referenced by AllocateFromVertexBuffer(), BIAS::clfMemory::clfMemory(), and BIAS::clfMemory::GLId().
|
protectedinherited |
Definition at line 59 of file clfMemory.hh.
Referenced by BIAS::clfImage3D::Allocate(), BIAS::clfImage2D::Allocate(), Allocate(), BIAS::clfImage2D::AllocateFromTexture2D(), BIAS::clfImage3D::AllocateFromTexture3D(), AllocateFromVertexBuffer(), and BIAS::clfMemory::clfMemory().
|
protectedinherited |
Definition at line 55 of file clfMemory.hh.
Referenced by BIAS::clfMemory::clfMemory(), CopyBuffer(), BIAS::clfImage3D::CopyToImage(), BIAS::clfImage2D::CopyToImage(), MapBuffer(), BIAS::clfImage3D::MapImage(), BIAS::clfImage2D::MapImage(), ReadFromBuffer(), BIAS::clfImage3D::ReadFromImage(), BIAS::clfImage2D::ReadFromImage(), BIAS::clfMemory::UnMap(), WriteToBuffer(), BIAS::clfImage3D::WriteToImage(), and BIAS::clfImage2D::WriteToImage().
|
protectedinherited |
Definition at line 60 of file clfMemory.hh.
Referenced by BIAS::clfImage3D::Allocate(), BIAS::clfImage2D::Allocate(), Allocate(), BIAS::clfImage2D::AllocateFromTexture2D(), BIAS::clfImage3D::AllocateFromTexture3D(), AllocateFromVertexBuffer(), BIAS::clfMemory::clfMemory(), and BIAS::clfMemory::GLId().
|
protectedinherited |
Definition at line 58 of file clfMemory.hh.
Referenced by BIAS::clfImage3D::Allocate(), BIAS::clfImage2D::Allocate(), Allocate(), BIAS::clfImage2D::AllocateFromTexture2D(), BIAS::clfImage3D::AllocateFromTexture3D(), AllocateFromVertexBuffer(), BIAS::clfMemory::clfMemory(), CopyBuffer(), MapBuffer(), ReadFromBuffer(), and WriteToBuffer().