12.07.2015 Views

NVIDIA CUDA

NVIDIA CUDA

NVIDIA CUDA

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.14 C++ API Routines 83Parameters:offset - Offset in bytestex - Texture to binddevPtr - Memory area on devicedesc - Channel formatsize - Size of the memory area pointed to by devPtrReturns:Note:See also:cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidTextureNote that this function may also return error codes from previous, asynchronous launches.cudaCreateChannelDesc (C++ API), cudaGetChannelDesc, cudaGetTextureReference, cudaBindTexture (C API),cudaBindTexture (C++ API, inherited channel descriptor), cudaBindTexture2D (C++ API), cudaBindTexture-ToArray (C++ API), cudaBindTextureToArray (C++ API, inherited channel descriptor), cudaUnbindTexture (C++API), cudaGetTextureAlignmentOffset (C++ API)3.14.2.3 template cudaError_tcudaBindTexture2D (size_t ∗ offset, const struct texture< T, dim, readMode > & tex, const void ∗devPtr, const struct cudaChannelFormatDesc & desc, 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 bywidth in texel units, height in texel units, and pitch in byte units. desc describes how the memory is interpretedwhen fetching values from the texture. 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 offsetmust 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 NULLmay be passed as the offset parameter.Parameters:offset - Offset in bytestex - Texture reference to binddevPtr - 2D memory area on devicedesc - Channel formatwidth - Width in texel unitsheight - Height in texel unitspitch - Pitch in bytesReturns:Note:cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidTextureNote that this function may also return error codes from previous, asynchronous launches.Generated on Wed Apr 1 16:11:42 2009 for <strong>NVIDIA</strong> <strong>CUDA</strong> Library by Doxygen

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!