Point Cloud Library (PCL)
1.14.1-dev
|
DeviceMemory class More...
#include </__w/1/s/gpu/containers/include/pcl/gpu/containers/device_memory.h>
Public Member Functions | |
DeviceMemory () | |
Empty constructor. More... | |
~DeviceMemory () | |
Destructor. More... | |
DeviceMemory (std::size_t sizeBytes_arg) | |
Allocates internal buffer in GPU memory. More... | |
DeviceMemory (void *ptr_arg, std::size_t sizeBytes_arg) | |
Initializes with user allocated buffer. More... | |
DeviceMemory (const DeviceMemory &other_arg) | |
Copy constructor. More... | |
DeviceMemory & | operator= (const DeviceMemory &other_arg) |
Assignment operator. More... | |
void | create (std::size_t sizeBytes_arg) |
Allocates internal buffer in GPU memory. More... | |
void | release () |
Decrements reference counter and releases internal buffer if needed. More... | |
void | copyTo (DeviceMemory &other) const |
Performs data copying. More... | |
void | upload (const void *host_ptr_arg, std::size_t sizeBytes_arg) |
Uploads data to internal buffer in GPU memory. More... | |
bool | upload (const void *host_ptr_arg, std::size_t device_begin_byte_offset, std::size_t num_bytes) |
Uploads data from CPU memory to device array. More... | |
void | download (void *host_ptr_arg) const |
Downloads data from internal buffer to CPU memory. More... | |
bool | download (void *host_ptr_arg, std::size_t device_begin_byte_offset, std::size_t num_bytes) const |
Downloads data from internal buffer to CPU memory. More... | |
void | swap (DeviceMemory &other_arg) |
Performs swap of data pointed with another device memory. More... | |
template<class T > | |
T * | ptr () |
Returns pointer for internal buffer in GPU memory. More... | |
template<class T > | |
const T * | ptr () const |
Returns constant pointer for internal buffer in GPU memory. More... | |
template<class U > | |
operator PtrSz< U > () const | |
Conversion to PtrSz for passing to kernel functions. More... | |
bool | empty () const |
Returns true if unallocated otherwise false. More... | |
std::size_t | sizeBytes () const |
DeviceMemory class
Definition at line 54 of file device_memory.h.
pcl::gpu::DeviceMemory::DeviceMemory | ( | ) |
Empty constructor.
pcl::gpu::DeviceMemory::~DeviceMemory | ( | ) |
Destructor.
pcl::gpu::DeviceMemory::DeviceMemory | ( | std::size_t | sizeBytes_arg | ) |
Allocates internal buffer in GPU memory.
sizeBytes_arg | amount of memory to allocate |
pcl::gpu::DeviceMemory::DeviceMemory | ( | void * | ptr_arg, |
std::size_t | sizeBytes_arg | ||
) |
Initializes with user allocated buffer.
Reference counting is disabled in this case.
ptr_arg | pointer to buffer |
sizeBytes_arg | buffer size |
pcl::gpu::DeviceMemory::DeviceMemory | ( | const DeviceMemory & | other_arg | ) |
Copy constructor.
Just increments reference counter.
void pcl::gpu::DeviceMemory::copyTo | ( | DeviceMemory & | other | ) | const |
Performs data copying.
If destination size differs it will be reallocated.
other | destination container |
Referenced by pcl::gpu::DeviceArray< T >::copyTo().
void pcl::gpu::DeviceMemory::create | ( | std::size_t | sizeBytes_arg | ) |
Allocates internal buffer in GPU memory.
If internal buffer was created before the function recreates it with new size. If new and old sizes are equal it does nothing.
sizeBytes_arg | buffer size |
void pcl::gpu::DeviceMemory::download | ( | void * | host_ptr_arg | ) | const |
Downloads data from internal buffer to CPU memory.
host_ptr_arg | pointer to buffer to download |
Referenced by pcl::gpu::DeviceArray< T >::download().
bool pcl::gpu::DeviceMemory::download | ( | void * | host_ptr_arg, |
std::size_t | device_begin_byte_offset, | ||
std::size_t | num_bytes | ||
) | const |
Downloads data from internal buffer to CPU memory.
host_ptr_arg | pointer to buffer to download |
device_begin_byte_offset | first byte position to download |
num_bytes | number of bytes to download |
bool pcl::gpu::DeviceMemory::empty | ( | ) | const |
Returns true if unallocated otherwise false.
Referenced by pcl::gpu::kinfuLS::StandaloneMarchingCubes< PointT >::convertTrianglesToMesh().
|
inline |
Conversion to PtrSz for passing to kernel functions.
Definition at line 60 of file device_memory.hpp.
References pcl::gpu::DevPtr< T >::data, and pcl::gpu::PtrSz< T >::size.
DeviceMemory& pcl::gpu::DeviceMemory::operator= | ( | const DeviceMemory & | other_arg | ) |
Assignment operator.
Just increments reference counter.
Referenced by pcl::gpu::DeviceArray< T >::operator=().
|
inline |
Returns pointer for internal buffer in GPU memory.
Definition at line 47 of file device_memory.hpp.
|
inline |
Returns constant pointer for internal buffer in GPU memory.
Definition at line 54 of file device_memory.hpp.
void pcl::gpu::DeviceMemory::release | ( | ) |
Decrements reference counter and releases internal buffer if needed.
std::size_t pcl::gpu::DeviceMemory::sizeBytes | ( | ) | const |
Referenced by pcl::gpu::AsyncCopy< T >::download(), and pcl::gpu::TextureBinder::TextureBinder().
void pcl::gpu::DeviceMemory::swap | ( | DeviceMemory & | other_arg | ) |
Performs swap of data pointed with another device memory.
other_arg | device memory to swap with |
Referenced by pcl::gpu::DeviceArray< T >::swap().
bool pcl::gpu::DeviceMemory::upload | ( | const void * | host_ptr_arg, |
std::size_t | device_begin_byte_offset, | ||
std::size_t | num_bytes | ||
) |
Uploads data from CPU memory to device array.
host_ptr_arg | pointer to buffer to upload |
device_begin_byte_offset | first byte position to upload to |
num_bytes | number of bytes to upload |
void pcl::gpu::DeviceMemory::upload | ( | const void * | host_ptr_arg, |
std::size_t | sizeBytes_arg | ||
) |
Uploads data to internal buffer in GPU memory.
It calls create() inside to ensure that internal buffer size is enough.
host_ptr_arg | pointer to buffer to upload |
sizeBytes_arg | buffer size |
Referenced by pcl::gpu::DeviceArray< float4 >::release(), and pcl::gpu::DeviceArray< T >::upload().