Class DriverAPINativeMethods.TextureReferenceManagement
Groups all texture reference management API calls
Inheritance
Inherited Members
Namespace: ManagedCuda
Assembly: ManagedCuda.dll
Syntax
public static class TextureReferenceManagement
Methods
cuTexRefCreate(ref CUtexref)
Creates a texture reference and returns its handle in pTexRef
. Once created, the application must call cuTexRefSetArray(CUtexref, CUarray, CUTexRefSetArrayFlags)
or cuTexRefSetAddress_v2(ref SizeT, CUtexref, CUdeviceptr, SizeT) 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. To associate the texture reference with a texture ordinal for a given function, the
application should call cuParamSetTexRef(CUfunction, CUParameterTexRef, CUtexref).
Declaration
public static CUResult cuTexRefCreate(ref CUtexref pTexRef)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | pTexRef | Returned texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefDestroy(CUtexref)
Destroys the texture reference specified by hTexRef
.
Declaration
public static CUResult cuTexRefDestroy(CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference to destroy |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefGetAddress(ref CUdeviceptr, CUtexref)
Returns in pdptr
the base address bound to the texture reference hTexRef
, or returns ErrorInvalidValue
if the texture reference is not bound to any device memory range.
Declaration
public static CUResult cuTexRefGetAddress(ref CUdeviceptr pdptr, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | pdptr | Returned device address |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefGetAddressMode(ref CUAddressMode, CUtexref, Int32)
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.
Declaration
public static CUResult cuTexRefGetAddressMode(ref CUAddressMode pam, CUtexref hTexRef, int dim)
Parameters
Type | Name | Description |
---|---|---|
CUAddressMode | pam | Returned addressing mode |
CUtexref | hTexRef | Texture reference |
System.Int32 | dim | Dimension |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefGetArray(ref CUarray, CUtexref)
Returns in phArray
the CUDA array bound to the texture reference hTexRef
, or returns ErrorInvalidValue
if the texture reference is not bound to any CUDA array.
Declaration
public static CUResult cuTexRefGetArray(ref CUarray phArray, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
CUarray | phArray | Returned array |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefGetBorderColor(Single[], CUtexref)
Gets the border color used by a texture reference
Returns in \p pBorderColor, values of the RGBA color used by the texture reference \p hTexRef.
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
Declaration
public static CUResult cuTexRefGetBorderColor(float[] pBorderColor, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | pBorderColor | Returned Type and Value of RGBA color |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult |
cuTexRefGetFilterMode(ref CUFilterMode, CUtexref)
Returns in pfm
the filtering mode of the texture reference hTexRef
.
Declaration
public static CUResult cuTexRefGetFilterMode(ref CUFilterMode pfm, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
CUFilterMode | pfm | Returned filtering mode |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefGetFlags(ref CUTexRefSetFlags, CUtexref)
Returns in pFlags
the flags of the texture reference hTexRef
.
Declaration
public static CUResult cuTexRefGetFlags(ref CUTexRefSetFlags pFlags, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
CUTexRefSetFlags | pFlags | Returned flags |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefGetFormat(ref CUArrayFormat, ref Int32, CUtexref)
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.
Declaration
public static CUResult cuTexRefGetFormat(ref CUArrayFormat pFormat, ref int pNumChannels, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
CUArrayFormat | pFormat | Returned format |
System.Int32 | pNumChannels | Returned number of components |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefGetMaxAnisotropy(ref Int32, CUtexref)
Returns the maximum aniostropy in pmaxAniso
that's used when reading memory through
the texture reference.
Declaration
public static CUResult cuTexRefGetMaxAnisotropy(ref int pmaxAniso, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pmaxAniso | Returned maximum anisotropy |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue. |
cuTexRefGetMipmapFilterMode(ref CUFilterMode, CUtexref)
Returns the mipmap filtering mode in pfm
that's used when reading memory through
the texture reference hTexRef
.
Declaration
public static CUResult cuTexRefGetMipmapFilterMode(ref CUFilterMode pfm, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
CUFilterMode | pfm | Returned mipmap filtering mode |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult |
cuTexRefGetMipmapLevelBias(ref Single, CUtexref)
Returns the mipmap level bias in pBias
that's added to the specified mipmap
level when reading memory through the texture reference hTexRef
.
Declaration
public static CUResult cuTexRefGetMipmapLevelBias(ref float pbias, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
System.Single | pbias | Returned mipmap level bias |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue. |
cuTexRefGetMipmapLevelClamp(ref Single, ref Single, CUtexref)
Returns the min/max mipmap level clamps in pminMipmapLevelClamp
and pmaxMipmapLevelClamp
that's used when reading memory through the texture reference hTexRef
.
Declaration
public static CUResult cuTexRefGetMipmapLevelClamp(ref float pminMipmapLevelClamp, ref float pmaxMipmapLevelClamp, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
System.Single | pminMipmapLevelClamp | Returned mipmap min level clamp |
System.Single | pmaxMipmapLevelClamp | Returned mipmap max level clamp |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue. |
cuTexRefGetMipmappedArray(ref CUmipmappedArray, CUtexref)
Returns in phMipmappedArray
the CUDA mipmapped array bound to the texture
reference hTexRef
, or returns ErrorInvalidValue if the texture reference
is not bound to any CUDA mipmapped array.
Declaration
public static CUResult cuTexRefGetMipmappedArray(ref CUmipmappedArray phMipmappedArray, CUtexref hTexRef)
Parameters
Type | Name | Description |
---|---|---|
CUmipmappedArray | phMipmappedArray | Returned mipmapped array |
CUtexref | hTexRef | Texture reference |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue. |
cuTexRefSetAddress_v2(ref SizeT, CUtexref, CUdeviceptr, SizeT)
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_v2(ref SizeT, CUtexref, CUdeviceptr, SizeT) 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_v2(ref CUdeviceptr, SizeT), the offset is guaranteed to be 0 and null
may be
passed as the ByteOffset
parameter.
Declaration
public static CUResult cuTexRefSetAddress_v2(ref SizeT ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, SizeT bytes)
Parameters
Type | Name | Description |
---|---|---|
SizeT | ByteOffset | Returned byte offset |
CUtexref | hTexRef | Texture reference to bind |
CUdeviceptr | dptr | Device pointer to bind |
SizeT | bytes | Size of memory to bind in bytes |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefSetAddress2D_v2(CUtexref, ref CUDAArrayDescriptor, CUdeviceptr, SizeT)
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(CUtexref, CUarray, CUTexRefSetArrayFlags) to bind the corresponding texture
reference to an array, or cuTexRefSetAddress2D_v2(CUtexref, ref CUDAArrayDescriptor, CUdeviceptr, SizeT) to bind the texture reference to linear memory.
Function calls to cuTexRefSetFormat(CUtexref, CUArrayFormat, Int32) cannot follow calls to cuTexRefSetAddress2D_v2(CUtexref, ref CUDAArrayDescriptor, CUdeviceptr, SizeT) 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 TextureAlignment. If an unaligned dptr
is supplied,
ErrorInvalidValue is returned.
Declaration
public static CUResult cuTexRefSetAddress2D_v2(CUtexref hTexRef, ref CUDAArrayDescriptor desc, CUdeviceptr dptr, SizeT Pitch)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference to bind |
CUDAArrayDescriptor | desc | Descriptor of CUDA array |
CUdeviceptr | dptr | Device pointer to bind |
SizeT | Pitch | Line pitch in bytes> |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefSetAddressMode(CUtexref, Int32, CUAddressMode)
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. See CUAddressMode.
Note that this call has no effect if hTexRef
is bound to linear memory.
Declaration
public static CUResult cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUAddressMode am)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference |
System.Int32 | dim | Dimension |
CUAddressMode | am | Addressing mode to set |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefSetArray(CUtexref, CUarray, CUTexRefSetArrayFlags)
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
OverrideFormat. Any CUDA array previously bound to hTexRef is unbound.
Declaration
public static CUResult cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, CUTexRefSetArrayFlags Flags)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference to bind |
CUarray | hArray | Array to bind |
CUTexRefSetArrayFlags | Flags | Options (must be OverrideFormat) |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefSetBorderColor(CUtexref, Single[])
Sets the border color for a texture reference
Specifies the value of the RGBA color via the \p pBorderColor to the texture reference \p hTexRef. 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' component
Note 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.
Declaration
public static CUResult cuTexRefSetBorderColor(CUtexref hTexRef, float[] pBorderColor)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference |
System.Single[] | pBorderColor | RGBA color |
Returns
Type | Description |
---|---|
CUResult |
cuTexRefSetFilterMode(CUtexref, CUFilterMode)
Specifies the filtering mode fm
to be used when reading memory through the texture reference hTexRef
. See CUFilterMode.
Note that this call has no effect if hTexRef is bound to linear memory.
Declaration
public static CUResult cuTexRefSetFilterMode(CUtexref hTexRef, CUFilterMode fm)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference |
CUFilterMode | fm | Filtering mode to set |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefSetFlags(CUtexref, CUTexRefSetFlags)
Specifies optional flags via Flags
to specify the behavior of data returned through the texture reference hTexRef
. See CUTexRefSetFlags.
Declaration
public static CUResult cuTexRefSetFlags(CUtexref hTexRef, CUTexRefSetFlags Flags)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference |
CUTexRefSetFlags | Flags | Optional flags to set |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefSetFormat(CUtexref, CUArrayFormat, Int32)
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 CUDAArrayDescriptor structure:
They specify the format of each component and the number of components per array element.
Declaration
public static CUResult cuTexRefSetFormat(CUtexref hTexRef, CUArrayFormat fmt, int NumPackedComponents)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference |
CUArrayFormat | fmt | Format to set |
System.Int32 | NumPackedComponents | Number of components per array element |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuTexRefSetMaxAnisotropy(CUtexref, UInt32)
Specifies the maximum aniostropy maxAniso
to be used when reading memory through
the texture reference hTexRef
.
Note that this call has no effect if hTexRef
is not bound to a mipmapped array.
Declaration
public static CUResult cuTexRefSetMaxAnisotropy(CUtexref hTexRef, uint maxAniso)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference |
System.UInt32 | maxAniso | Maximum anisotropy |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue. |
cuTexRefSetMipmapFilterMode(CUtexref, CUFilterMode)
Specifies the mipmap filtering mode fm
to be used when reading memory through
the texture reference hTexRef
.
Note that this call has no effect if hTexRef
is not bound to a mipmapped array.
Declaration
public static CUResult cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUFilterMode fm)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference |
CUFilterMode | fm | Filtering mode to set |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue. |
cuTexRefSetMipmapLevelBias(CUtexref, Single)
Specifies the mipmap level bias bias
to be added to the specified mipmap level when
reading memory through the texture reference hTexRef
.
Note that this call has no effect if hTexRef
is not bound to a mipmapped array.
Declaration
public static CUResult cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference |
System.Single | bias | Mipmap level bias |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue. |
cuTexRefSetMipmapLevelClamp(CUtexref, Single, Single)
Specifies the min/max mipmap level clamps, minMipmapLevelClamp
and maxMipmapLevelClamp
respectively, to be used when reading memory through the texture reference
hTexRef
.
Note that this call has no effect if hTexRef
is not bound to a mipmapped array.
Declaration
public static CUResult cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference |
System.Single | minMipmapLevelClamp | Mipmap min level clamp |
System.Single | maxMipmapLevelClamp | Mipmap max level clamp |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue. |
cuTexRefSetMipmappedArray(CUtexref, CUmipmappedArray, CUTexRefSetArrayFlags)
Binds the CUDA mipmapped array hMipmappedArray
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 OverrideFormat.
Any CUDA array previously bound to hTexRef
is unbound.
Declaration
public static CUResult cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, CUTexRefSetArrayFlags Flags)
Parameters
Type | Name | Description |
---|---|---|
CUtexref | hTexRef | Texture reference to bind |
CUmipmappedArray | hMipmappedArray | Mipmapped array to bind |
CUTexRefSetArrayFlags | Flags | Options (must be OverrideFormat) |
Returns
Type | Description |
---|---|
CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|