GPUOcelot
Modules | Functions

Texture Reference Management

CUDA Driver API
Collaboration diagram for Texture Reference Management:

Modules

 Texture Reference Management [DEPRECATED]

Functions

CUresult CUDAAPI cuTexRefSetArray (CUtexref hTexRef, CUarray hArray, unsigned int Flags)
 Binds an array as a texture reference.
CUresult CUDAAPI cuTexRefSetFormat (CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents)
 Sets the format for a texture reference.
CUresult CUDAAPI cuTexRefSetAddressMode (CUtexref hTexRef, int dim, CUaddress_mode am)
 Sets the addressing mode for a texture reference.
CUresult CUDAAPI cuTexRefSetFilterMode (CUtexref hTexRef, CUfilter_mode fm)
 Sets the filtering mode for a texture reference.
CUresult CUDAAPI cuTexRefSetFlags (CUtexref hTexRef, unsigned int Flags)
 Sets the flags for a texture reference.
CUresult CUDAAPI cuTexRefGetArray (CUarray *phArray, CUtexref hTexRef)
 Gets the array bound to a texture reference.
CUresult CUDAAPI cuTexRefGetAddressMode (CUaddress_mode *pam, CUtexref hTexRef, int dim)
 Gets the addressing mode used by a texture reference.
CUresult CUDAAPI cuTexRefGetFilterMode (CUfilter_mode *pfm, CUtexref hTexRef)
 Gets the filter-mode used by a texture reference.
CUresult CUDAAPI cuTexRefGetFormat (CUarray_format *pFormat, int *pNumChannels, CUtexref hTexRef)
 Gets the format used by a texture reference.
CUresult CUDAAPI cuTexRefGetFlags (unsigned int *pFlags, CUtexref hTexRef)
 Gets the flags used by a texture reference.
CUresult CUDAAPI cuTexRefSetAddress (size_t *ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes)
 Binds an address as a texture reference.
CUresult CUDAAPI cuTexRefSetAddress2D (CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR *desc, CUdeviceptr dptr, size_t Pitch)
 Binds an address as a 2D texture reference.
CUresult CUDAAPI cuTexRefGetAddress (CUdeviceptr *pdptr, CUtexref hTexRef)
 Gets the address associated with a texture reference.

Detailed Description

This section describes the texture reference management functions of the low-level CUDA driver application programming interface.


Function Documentation

CUresult CUDAAPI cuTexRefGetAddress ( CUdeviceptr pdptr,
CUtexref  hTexRef 
)

Gets the address associated with a texture reference.

Returns in *pdptr the base address bound to the texture reference hTexRef, or returns CUDA_ERROR_INVALID_VALUE if the texture reference is not bound to any device memory range.

Parameters:
pdptr- Returned device address
hTexRef- Texture reference
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefGetAddressMode ( CUaddress_mode pam,
CUtexref  hTexRef,
int  dim 
)

Gets the addressing mode used by a texture reference.

Returns in *pam the addressing mode corresponding to the dimension dim of the texture reference hTexRef. Currently, the only valid value for dim are 0 and 1.

Parameters:
pam- Returned addressing mode
hTexRef- Texture reference
dim- Dimension
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefGetArray ( CUarray phArray,
CUtexref  hTexRef 
)

Gets the array bound to a texture reference.

Returns in *phArray the CUDA array bound to the texture reference hTexRef, or returns CUDA_ERROR_INVALID_VALUE if the texture reference is not bound to any CUDA array.

Parameters:
phArray- Returned array
hTexRef- Texture reference
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefGetFilterMode ( CUfilter_mode pfm,
CUtexref  hTexRef 
)

Gets the filter-mode used by a texture reference.

Returns in *pfm the filtering mode of the texture reference hTexRef.

Parameters:
pfm- Returned filtering mode
hTexRef- Texture reference
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefGetFlags ( unsigned int *  pFlags,
CUtexref  hTexRef 
)
CUresult CUDAAPI cuTexRefGetFormat ( CUarray_format pFormat,
int *  pNumChannels,
CUtexref  hTexRef 
)

Gets the format used by a texture reference.

Returns in *pFormat and *pNumChannels the format and number of components of the CUDA array bound to the texture reference hTexRef. If pFormat or pNumChannels is NULL, it will be ignored.

Parameters:
pFormat- Returned format
pNumChannels- Returned number of components
hTexRef- Texture reference
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags
CUresult CUDAAPI cuTexRefSetAddress ( size_t ByteOffset,
CUtexref  hTexRef,
CUdeviceptr  dptr,
size_t  bytes 
)

Binds an address as a texture reference.

Binds a linear address range to the texture reference hTexRef. Any previous address or CUDA array state associated with the texture reference is superseded by this function. Any memory previously bound to hTexRef is unbound.

Since the hardware enforces an alignment requirement on texture base addresses, cuTexRefSetAddress() passes back a byte offset in *ByteOffset 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 ::tex1Dfetch() function.

If the device memory pointer was returned from cuMemAlloc(), the offset is guaranteed to be 0 and NULL may be passed as the ByteOffset parameter.

Parameters:
ByteOffset- Returned byte offset
hTexRef- Texture reference to bind
dptr- Device pointer to bind
bytes- Size of memory to bind in bytes
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefSetAddress2D ( CUtexref  hTexRef,
const CUDA_ARRAY_DESCRIPTOR desc,
CUdeviceptr  dptr,
size_t  Pitch 
)

Binds an address as a 2D texture reference.

Binds a linear address range to the texture reference hTexRef. Any previous address or CUDA array state associated with the texture reference is superseded by this function. Any memory previously bound to hTexRef is unbound.

Using a ::tex2D() function inside a kernel requires a call to either cuTexRefSetArray() to bind the corresponding texture reference to an array, or cuTexRefSetAddress2D() to bind the texture reference to linear memory.

Function calls to cuTexRefSetFormat() cannot follow calls to cuTexRefSetAddress2D() for the same texture reference.

It is required that dptr be aligned to the appropriate hardware-specific texture alignment. You can query this value using the device attribute CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT. If an unaligned dptr is supplied, CUDA_ERROR_INVALID_VALUE is returned.

Parameters:
hTexRef- Texture reference to bind
desc- Descriptor of CUDA array
dptr- Device pointer to bind
Pitch- Line pitch in bytes
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefSetAddressMode ( CUtexref  hTexRef,
int  dim,
CUaddress_mode  am 
)

Sets the addressing mode for a texture reference.

Specifies the addressing mode am for the given dimension dim of the texture reference hTexRef. If dim is zero, the addressing mode is applied to the first parameter of the functions used to fetch from the texture; if dim is 1, the second, and so on. CUaddress_mode is defined as:

Note that this call has no effect if hTexRef is bound to linear memory.

Parameters:
hTexRef- Texture reference
dim- Dimension
am- Addressing mode to set
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefSetArray ( CUtexref  hTexRef,
CUarray  hArray,
unsigned int  Flags 
)

Binds an array as a texture reference.

Binds the CUDA array hArray to the texture reference hTexRef. Any previous address or CUDA array state associated with the texture reference is superseded by this function. Flags must be set to CU_TRSA_OVERRIDE_FORMAT. Any CUDA array previously bound to hTexRef is unbound.

Parameters:
hTexRef- Texture reference to bind
hArray- Array to bind
Flags- Options (must be CU_TRSA_OVERRIDE_FORMAT)
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefSetFilterMode ( CUtexref  hTexRef,
CUfilter_mode  fm 
)

Sets the filtering mode for a texture reference.

Specifies the filtering mode fm to be used when reading memory through the texture reference hTexRef. CUfilter_mode_enum is defined as:

Note that this call has no effect if hTexRef is bound to linear memory.

Parameters:
hTexRef- Texture reference
fm- Filtering mode to set
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefSetFlags ( CUtexref  hTexRef,
unsigned int  Flags 
)

Sets the flags for a texture reference.

Specifies optional flags via Flags to specify the behavior of data returned through the texture reference hTexRef. The valid flags are:

  • CU_TRSF_READ_AS_INTEGER, which suppresses the default behavior of having the texture promote integer data to floating point data in the range [0, 1];
  • CU_TRSF_NORMALIZED_COORDINATES, which suppresses the default behavior of having the texture coordinates range from [0, Dim) where Dim is the width or height of the CUDA array. Instead, the texture coordinates [0, 1.0) reference the entire breadth of the array dimension;
Parameters:
hTexRef- Texture reference
Flags- Optional flags to set
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
CUresult CUDAAPI cuTexRefSetFormat ( CUtexref  hTexRef,
CUarray_format  fmt,
int  NumPackedComponents 
)

Sets the format for a texture reference.

Specifies the format of the data to be read by the texture reference hTexRef. fmt and NumPackedComponents are exactly analogous to the ::Format and ::NumChannels members of the CUDA_ARRAY_DESCRIPTOR structure: They specify the format of each component and the number of components per array element.

Parameters:
hTexRef- Texture reference
fmt- Format to set
NumPackedComponents- Number of components per array element
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
See also:
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines