template<class T , int dim, enum cudaTextureReadMode readMode>
cudaError_t cudaBindTexture2D ( size_t *  offset,
const struct texture< T, dim, readMode > &  tex,
const void *  devPtr,
size_t  width,
size_t  height,
size_t  pitch 
)

Binds the 2D memory area pointed to by devPtr to the texture reference tex. The size of the area is constrained by width in texel units, height in texel units, and pitch in byte units. The channel descriptor is inherited from the texture reference type. Any memory previously bound to tex is unbound.

Since the hardware enforces an alignment requirement on texture base addresses, cudaBindTexture2D() returns in *offset a byte offset that must be applied to texture fetches in order to read from the desired memory. This offset must be divided by the texel size and passed to kernels that read from the texture so they can be applied to the tex2D() function. If the device memory pointer was returned from cudaMalloc(), the offset is guaranteed to be 0 and NULL may be passed as the offset parameter.

Parameters:
offset - Offset in bytes
tex - Texture reference to bind
devPtr - 2D memory area on device
width - Width in texel units
height - Height in texel units
pitch - Pitch in bytes
Returns:
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidTexture
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
cudaCreateChannelDesc (C++ API), cudaGetChannelDesc, cudaGetTextureReference, cudaBindTexture (C++ API), cudaBindTexture (C++ API, inherited channel descriptor), cudaBindTexture2D (C API), cudaBindTexture2D (C++ API), cudaBindTextureToArray (C++ API), cudaBindTextureToArray (C++ API, inherited channel descriptor), cudaUnbindTexture (C++ API), cudaGetTextureAlignmentOffset (C++ API)


Generated by Doxygen for NVIDIA CUDA Library  NVIDIA