|  | 
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 devPtrto the texture referencetex. The size of the area is constrained bywidthin texel units,heightin texel units, andpitchin byte units. The channel descriptor is inherited from the texture reference type. Any memory previously bound totexis unbound. 
Since the hardware enforces an alignment requirement on texture base addresses, cudaBindTexture2D() returns in *offseta 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 theoffsetparameter. 
 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) 
 
     |