6.43. Texture Reference Management [DEPRECATED]
This section describes the deprecated texture reference management functions of the low-level CUDA driver application programming interface.
Functions
- CUresult cuTexRefCreate(CUtexref *pTexRef)
Creates a texture reference.
- CUresult cuTexRefDestroy(CUtexref hTexRef)
Destroys a texture reference.
- CUresult cuTexRefGetAddress(CUdeviceptr *pdptr, CUtexref hTexRef)
Gets the address associated with a texture reference.
- CUresult cuTexRefGetAddressMode(CUaddress_mode *pam, CUtexref hTexRef, int dim)
Gets the addressing mode used by a texture reference.
- CUresult cuTexRefGetArray(CUarray *phArray, CUtexref hTexRef)
Gets the array bound to a texture reference.
- CUresult cuTexRefGetBorderColor(float *pBorderColor, CUtexref hTexRef)
Gets the border color used by a texture reference.
- CUresult cuTexRefGetFilterMode(CUfilter_mode *pfm, CUtexref hTexRef)
Gets the filter-mode used by a texture reference.
- CUresult cuTexRefGetFlags(unsigned int *pFlags, CUtexref hTexRef)
Gets the flags used by a texture reference.
- CUresult cuTexRefGetFormat(CUarray_format *pFormat, int *pNumChannels, CUtexref hTexRef)
Gets the format used by a texture reference.
- CUresult cuTexRefGetMaxAnisotropy(int *pmaxAniso, CUtexref hTexRef)
Gets the maximum anisotropy for a texture reference.
- CUresult cuTexRefGetMipmapFilterMode(CUfilter_mode *pfm, CUtexref hTexRef)
Gets the mipmap filtering mode for a texture reference.
- CUresult cuTexRefGetMipmapLevelBias(float *pbias, CUtexref hTexRef)
Gets the mipmap level bias for a texture reference.
- CUresult cuTexRefGetMipmapLevelClamp(float *pminMipmapLevelClamp, float *pmaxMipmapLevelClamp, CUtexref hTexRef)
Gets the min/max mipmap level clamps for a texture reference.
- CUresult cuTexRefGetMipmappedArray(CUmipmappedArray *phMipmappedArray, CUtexref hTexRef)
Gets the mipmapped array bound to a texture reference.
- CUresult cuTexRefSetAddress(size_t *ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes)
Binds an address as a texture reference.
- CUresult cuTexRefSetAddress2D(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR *desc, CUdeviceptr dptr, size_t Pitch)
Binds an address as a 2D texture reference.
- CUresult cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am)
Sets the addressing mode for a texture reference.
- CUresult cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags)
Binds an array as a texture reference.
- CUresult cuTexRefSetBorderColor(CUtexref hTexRef, float *pBorderColor)
Sets the border color for a texture reference.
- CUresult cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm)
Sets the filtering mode for a texture reference.
- CUresult cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags)
Sets the flags for a texture reference.
- CUresult cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents)
Sets the format for a texture reference.
- CUresult cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso)
Sets the maximum anisotropy for a texture reference.
- CUresult cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm)
Sets the mipmap filtering mode for a texture reference.
- CUresult cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias)
Sets the mipmap level bias for a texture reference.
- CUresult cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp)
Sets the mipmap min/max mipmap level clamps for a texture reference.
- CUresult cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags)
Binds a mipmapped array to a texture reference.
6.43.1. Functions
-
CUresult cuTexRefCreate(CUtexref *pTexRef)
Creates a texture reference.
Creates a texture reference and returns its handle in
*pTexRef. Once created, the application must call cuTexRefSetArray() or cuTexRefSetAddress() to associate the reference with allocated memory. Other texture reference functions are used to specify the format and interpretation (addressing, filtering, etc.) to be used when the memory is read through this texture reference.See also
- Parameters
pTexRef – - Returned texture reference
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefDestroy(CUtexref hTexRef)
Destroys a texture reference.
Destroys the texture reference specified by
hTexRef.See also
- Parameters
hTexRef – - Texture reference to destroy
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefGetAddress(CUdeviceptr *pdptr, CUtexref hTexRef)
Gets the address associated with a texture reference.
Returns in
*pdptrthe base address bound to the texture referencehTexRef, or returns CUDA_ERROR_INVALID_VALUE if the texture reference is not bound to any device memory range.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult cuTexRefGetAddressMode(CUaddress_mode *pam, CUtexref hTexRef, int dim)
Gets the addressing mode used by a texture reference.
Returns in
*pamthe addressing mode corresponding to the dimensiondimof the texture referencehTexRef. Currently, the only valid value fordimare 0 and 1.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult cuTexRefGetArray(CUarray *phArray, CUtexref hTexRef)
Gets the array bound to a texture reference.
Returns in
*phArraythe CUDA array bound to the texture referencehTexRef, or returns CUDA_ERROR_INVALID_VALUE if the texture reference is not bound to any CUDA array.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult cuTexRefGetBorderColor(float *pBorderColor, CUtexref hTexRef)
Gets the border color used by a texture reference.
Returns in
pBorderColor, values of the RGBA color used by the texture referencehTexRef. The color value is of type float and holds color components in the following sequence: pBorderColor[0] holds ‘R’ component pBorderColor[1] holds ‘G’ component pBorderColor[2] holds ‘B’ component pBorderColor[3] holds ‘A’ component- Parameters
hTexRef – - Texture reference
pBorderColor – - Returned Type and Value of RGBA color
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefGetFilterMode(CUfilter_mode *pfm, CUtexref hTexRef)
Gets the filter-mode used by a texture reference.
Returns in
*pfmthe filtering mode of the texture referencehTexRef.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult cuTexRefGetFlags(unsigned int *pFlags, CUtexref hTexRef)
Gets the flags used by a texture reference.
Returns in
*pFlagsthe flags of the texture referencehTexRef.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFormat
- Parameters
pFlags – - Returned flags
hTexRef – - Texture reference
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefGetFormat(CUarray_format *pFormat, int *pNumChannels, CUtexref hTexRef)
Gets the format used by a texture reference.
Returns in
*pFormatand*pNumChannelsthe format and number of components of the CUDA array bound to the texture referencehTexRef. IfpFormatorpNumChannelsis NULL, it will be ignored.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags
- 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
-
CUresult cuTexRefGetMaxAnisotropy(int *pmaxAniso, CUtexref hTexRef)
Gets the maximum anisotropy for a texture reference.
Returns the maximum anisotropy in
pmaxAnisothat’s used when reading memory through the texture referencehTexRef.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- Parameters
pmaxAniso – - Returned maximum anisotropy
hTexRef – - Texture reference
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefGetMipmapFilterMode(CUfilter_mode *pfm, CUtexref hTexRef)
Gets the mipmap filtering mode for a texture reference.
Returns the mipmap filtering mode in
pfmthat’s used when reading memory through the texture referencehTexRef.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- Parameters
pfm – - Returned mipmap filtering mode
hTexRef – - Texture reference
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefGetMipmapLevelBias(float *pbias, CUtexref hTexRef)
Gets the mipmap level bias for a texture reference.
Returns the mipmap level bias in
pBiasthat’s added to the specified mipmap level when reading memory through the texture referencehTexRef.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- Parameters
pbias – - Returned mipmap level bias
hTexRef – - Texture reference
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefGetMipmapLevelClamp(float *pminMipmapLevelClamp, float *pmaxMipmapLevelClamp, CUtexref hTexRef)
Gets the min/max mipmap level clamps for a texture reference.
Returns the min/max mipmap level clamps in
pminMipmapLevelClampandpmaxMipmapLevelClampthat’s used when reading memory through the texture referencehTexRef.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- Parameters
pminMipmapLevelClamp – - Returned mipmap min level clamp
pmaxMipmapLevelClamp – - Returned mipmap max level clamp
hTexRef – - Texture reference
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefGetMipmappedArray(CUmipmappedArray *phMipmappedArray, CUtexref hTexRef)
Gets the mipmapped array bound to a texture reference.
Returns in
*phMipmappedArraythe CUDA mipmapped array bound to the texture referencehTexRef, or returns CUDA_ERROR_INVALID_VALUE if the texture reference is not bound to any CUDA mipmapped array.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- Parameters
phMipmappedArray – - Returned mipmapped array
hTexRef – - Texture reference
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult 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 tohTexRefis unbound.Since the hardware enforces an alignment requirement on texture base addresses, cuTexRefSetAddress() passes back a byte offset in
*ByteOffsetthat 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
ByteOffsetparameter.The total number of elements (or texels) in the linear address range cannot exceed CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH. The number of elements is computed as (
bytes/ bytesPerElement), where bytesPerElement is determined from the data format and number of components set using cuTexRefSetFormat().See also
cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult 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 tohTexRefis 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
dptrbe aligned to the appropriate hardware-specific texture alignment. You can query this value using the device attribute CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT. If an unaligneddptris supplied, CUDA_ERROR_INVALID_VALUE is returned.Pitchhas to be aligned to the hardware-specific texture pitch alignment. This value can be queried using the device attribute CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT. If an unalignedPitchis supplied, CUDA_ERROR_INVALID_VALUE is returned.Width and Height, which are specified in elements (or texels), cannot exceed CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH and CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT respectively.
Pitch, which is specified in bytes, cannot exceed CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH.See also
cuTexRefSetAddress, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am)
Sets the addressing mode for a texture reference.
Specifies the addressing mode
amfor the given dimensiondimof the texture referencehTexRef. Ifdimis zero, the addressing mode is applied to the first parameter of the functions used to fetch from the texture; ifdimis 1, the second, and so on. CUaddress_mode is defined as:typedef enum CUaddress_mode_enum { CU_TR_ADDRESS_MODE_WRAP = 0, CU_TR_ADDRESS_MODE_CLAMP = 1, CU_TR_ADDRESS_MODE_MIRROR = 2, CU_TR_ADDRESS_MODE_BORDER = 3 } CUaddress_mode;
Note that this call has no effect if
hTexRefis bound to linear memory. Also, if the flag, CU_TRSF_NORMALIZED_COORDINATES, is not set, the only supported address mode is CU_TR_ADDRESS_MODE_CLAMP.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags)
Binds an array as a texture reference.
Binds the CUDA array
hArrayto the texture referencehTexRef. Any previous address or CUDA array state associated with the texture reference is superseded by this function.Flagsmust be set to CU_TRSA_OVERRIDE_FORMAT. Any CUDA array previously bound tohTexRefis unbound.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult cuTexRefSetBorderColor(CUtexref hTexRef, float *pBorderColor)
Sets the border color for a texture reference.
Specifies the value of the RGBA color via the
pBorderColorto the texture referencehTexRef. The color value supports only float type and holds color components in the following sequence: pBorderColor[0] holds ‘R’ component pBorderColor[1] holds ‘G’ component pBorderColor[2] holds ‘B’ component pBorderColor[3] holds ‘A’ componentNote that the color values can be set only when the Address mode is set to CU_TR_ADDRESS_MODE_BORDER using cuTexRefSetAddressMode. Applications using integer border color values have to “reinterpret_cast” their values to float.
- Parameters
hTexRef – - Texture reference
pBorderColor – - RGBA color
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm)
Sets the filtering mode for a texture reference.
Specifies the filtering mode
fmto be used when reading memory through the texture referencehTexRef. ::CUfilter_mode_enum is defined as:typedef enum CUfilter_mode_enum { CU_TR_FILTER_MODE_POINT = 0, CU_TR_FILTER_MODE_LINEAR = 1 } CUfilter_mode;
Note that this call has no effect if
hTexRefis bound to linear memory.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags)
Sets the flags for a texture reference.
Specifies optional flags via
Flagsto specify the behavior of data returned through the texture referencehTexRef. 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]. Note that texture with 32-bit integer format would not be promoted, regardless of whether or not this flag is specified;
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;
CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION, which disables any trilinear filtering optimizations. Trilinear optimizations improve texture filtering performance by allowing bilinear filtering on textures in scenarios where it can closely approximate the expected results.
See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult 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.fmtandNumPackedComponentsare 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.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat, ::cudaCreateChannelDesc
- 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
-
CUresult cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso)
Sets the maximum anisotropy for a texture reference.
Specifies the maximum anisotropy
maxAnisoto be used when reading memory through the texture referencehTexRef.Note that this call has no effect if
hTexRefis bound to linear memory.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- Parameters
hTexRef – - Texture reference
maxAniso – - Maximum anisotropy
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm)
Sets the mipmap filtering mode for a texture reference.
Specifies the mipmap filtering mode
fmto be used when reading memory through the texture referencehTexRef. ::CUfilter_mode_enum is defined as:typedef enum CUfilter_mode_enum { CU_TR_FILTER_MODE_POINT = 0, CU_TR_FILTER_MODE_LINEAR = 1 } CUfilter_mode;
Note that this call has no effect if
hTexRefis not bound to a mipmapped array.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- 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
-
CUresult cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias)
Sets the mipmap level bias for a texture reference.
Specifies the mipmap level bias
biasto be added to the specified mipmap level when reading memory through the texture referencehTexRef.Note that this call has no effect if
hTexRefis not bound to a mipmapped array.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- Parameters
hTexRef – - Texture reference
bias – - Mipmap level bias
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp)
Sets the mipmap min/max mipmap level clamps for a texture reference.
Specifies the min/max mipmap level clamps,
minMipmapLevelClampandmaxMipmapLevelClamprespectively, to be used when reading memory through the texture referencehTexRef.Note that this call has no effect if
hTexRefis not bound to a mipmapped array.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- Parameters
hTexRef – - Texture reference
minMipmapLevelClamp – - Mipmap min level clamp
maxMipmapLevelClamp – - Mipmap max level clamp
- Returns
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
-
CUresult cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags)
Binds a mipmapped array to a texture reference.
Binds the CUDA mipmapped array
hMipmappedArrayto the texture referencehTexRef. Any previous address or CUDA array state associated with the texture reference is superseded by this function.Flagsmust be set to CU_TRSA_OVERRIDE_FORMAT. Any CUDA array previously bound tohTexRefis unbound.See also
cuTexRefSetAddress, cuTexRefSetAddress2D, cuTexRefSetAddressMode, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, cuTexRefGetAddress, cuTexRefGetAddressMode, cuTexRefGetArray, cuTexRefGetFilterMode, cuTexRefGetFlags, cuTexRefGetFormat
- Parameters
hTexRef – - Texture reference to bind
hMipmappedArray – - Mipmapped 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