37 #ifndef PCL_GPU_UTILS_TEXTURE_BINDER_HPP_
38 #define PCL_GPU_UTILS_TEXTURE_BINDER_HPP_
40 #include <pcl/gpu/containers/device_array.h>
41 #include <pcl/gpu/utils/safe_call.hpp>
47 template <
class T, enum cudaTextureReadMode readMode>
51 cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>();
53 cudaBindTexture2D(0, tex, arr.
ptr(), desc, arr.
cols(), arr.
rows(), arr.
step()));
56 template <
class T, enum cudaTextureReadMode readMode>
60 cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>();
61 cudaSafeCall(cudaBindTexture(0, tex, arr.
ptr(), desc, arr.
sizeBytes()));
64 template <
class T, enum cudaTextureReadMode readMode>
68 cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>();
73 template <
class T, enum cudaTextureReadMode readMode>
77 cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>();
78 cudaSafeCall(cudaBindTexture(0, tex, arr.
data, desc, arr.
size * arr.
elemSize()));
84 const struct textureReference* texref;
int rows() const
Returns number of rows.
int cols() const
Returns number of elements in each row.
T * ptr(int y=0)
Returns pointer to given row in internal buffer.
T * ptr()
Returns pointer for internal buffer in GPU memory.
std::size_t step() const
Returns stride between two consecutive rows in bytes for internal buffer.
std::size_t sizeBytes() const
TextureBinder(const PtrStepSz< T > &arr, const struct texture< T, 2, readMode > &tex)
TextureBinder(const PtrSz< T > &arr, const struct texture< T, 1, readMode > &tex)
TextureBinder(const DeviceArray2D< T > &arr, const struct texture< T, 2, readMode > &tex)
TextureBinder(const DeviceArray< T > &arr, const struct texture< T, 1, readMode > &tex)
__PCL_GPU_HOST_DEVICE__ std::size_t elemSize() const
std::size_t step
stride between two consecutive rows in bytes.