Class CudaOpenGLBufferInteropResource
Wrapper for a CUgraphicsResource (OpenGL Buffer)
Inheritance
Inherited Members
Namespace: ManagedCuda
Assembly: ManagedCuda.dll
Syntax
public class CudaOpenGLBufferInteropResource : ICudaGraphicsInteropResource, IDisposable
Constructors
| Improve this Doc View SourceCudaOpenGLBufferInteropResource(UInt32, CUGraphicsRegisterFlags)
Registers a new graphics interop resource for interop with OpenGL buffer
Declaration
public CudaOpenGLBufferInteropResource(uint resource, CUGraphicsRegisterFlags flags)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | resource | OpenGL resource to register |
| CUGraphicsRegisterFlags | flags | register Flags |
CudaOpenGLBufferInteropResource(UInt32, CUGraphicsRegisterFlags, CUGraphicsMapResourceFlags)
Registers a new graphics interop resource for interop with OpenGL buffer
Declaration
public CudaOpenGLBufferInteropResource(uint resource, CUGraphicsRegisterFlags flags, CUGraphicsMapResourceFlags mapFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | resource | OpenGL resource to register |
| CUGraphicsRegisterFlags | flags | register Flags |
| CUGraphicsMapResourceFlags | mapFlags | resource mapping flags |
Properties
| Improve this Doc View SourceCUgraphicsResource
Declaration
public CUgraphicsResource CUgraphicsResource { get; }
Property Value
| Type | Description |
|---|---|
| CUgraphicsResource |
IsMapped
Declaration
public bool IsMapped { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsRegistered
Declaration
public bool IsRegistered { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
| Improve this Doc View SourceDispose()
Dispose
Declaration
public void Dispose()
Dispose(Boolean)
For IDisposable
Declaration
protected virtual void Dispose(bool fDisposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | fDisposing |
Finalize()
For dispose
Declaration
protected void Finalize()
GetCUgraphicsResource()
Declaration
public CUgraphicsResource GetCUgraphicsResource()
Returns
| Type | Description |
|---|---|
| CUgraphicsResource |
GetMappedArray1D(UInt32, UInt32)
Returns a CudaArray1D through which the subresource of the mapped graphics resource resource which
corresponds to array index arrayIndex and mipmap level mipLevel may be accessed. The pointer value in CudaArray1D
may change every time that resource is mapped.
If the resource is not a texture then it cannot be accessed via an array and ErrorNotMappedAsArray
exception is thrwon. If arrayIndex is not a valid array index for the resource then ErrorInvalidValue
exception is thrwon. If mipLevel is not a valid mipmap level for the resource then ErrorInvalidValue
exception is thrwon. If the resource is not mapped then ErrorNotMapped exception is thrwon.
Declaration
public CudaArray1D GetMappedArray1D(uint arrayIndex, uint mipLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | arrayIndex | |
| System.UInt32 | mipLevel |
Returns
| Type | Description |
|---|---|
| CudaArray1D |
GetMappedArray2D(UInt32, UInt32)
Returns a CudaArray2D through which the subresource of the mapped graphics resource resource which
corresponds to array index arrayIndex and mipmap level mipLevel may be accessed. The pointer value in CudaArray2D
may change every time that resource is mapped.
If the resource is not a texture then it cannot be accessed via an array and ErrorNotMappedAsArray
exception is thrwon. If arrayIndex is not a valid array index for the resource then ErrorInvalidValue
exception is thrwon. If mipLevel is not a valid mipmap level for the resource then ErrorInvalidValue
exception is thrwon. If the resource is not mapped then ErrorNotMapped exception is thrwon.
Declaration
public CudaArray2D GetMappedArray2D(uint arrayIndex, uint mipLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | arrayIndex | |
| System.UInt32 | mipLevel |
Returns
| Type | Description |
|---|---|
| CudaArray2D |
GetMappedArray3D(UInt32, UInt32)
Returns a CudaArray3D through which the subresource of the mapped graphics resource resource which
corresponds to array index arrayIndex and mipmap level mipLevel may be accessed. The pointer value in CudaArray3D
may change every time that resource is mapped.
If the resource is not a texture then it cannot be accessed via an array and ErrorNotMappedAsArray
exception is thrwon. If arrayIndex is not a valid array index for the resource then ErrorInvalidValue
exception is thrwon. If mipLevel is not a valid mipmap level for the resource then ErrorInvalidValue
exception is thrwon. If the resource is not mapped then ErrorNotMapped exception is thrwon.
Declaration
public CudaArray3D GetMappedArray3D(uint arrayIndex, uint mipLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | arrayIndex | |
| System.UInt32 | mipLevel |
Returns
| Type | Description |
|---|---|
| CudaArray3D |
GetMappedCUArray(UInt32, UInt32)
Returns a CUarray handle through which the subresource of the mapped graphics resource resource which
corresponds to array index arrayIndex and mipmap level mipLevel may be accessed. The pointer value in CUarray
may change every time that resource is mapped.
If the resource is not a texture then it cannot be accessed via an array and ErrorNotMappedAsArray
exception is thrwon. If arrayIndex is not a valid array index for the resource then ErrorInvalidValue
exception is thrwon. If mipLevel is not a valid mipmap level for the resource then ErrorInvalidValue
exception is thrwon. If the resource is not mapped then ErrorNotMapped exception is thrwon.
Declaration
public CUarray GetMappedCUArray(uint arrayIndex, uint mipLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | arrayIndex | |
| System.UInt32 | mipLevel |
Returns
| Type | Description |
|---|---|
| CUarray |
GetMappedCUMipmappedArray()
Returns a CUmipmappedArray handle through which the subresource of the mapped graphics resource resource which
corresponds to array index arrayIndex and mipmap level mipLevel may be accessed. The pointer value in CUmipmappedArray
may change every time that resource is mapped.
If the resource is not a texture then it cannot be accessed via an array and ErrorNotMappedAsArray
exception is thrwon. If arrayIndex is not a valid array index for the resource then ErrorInvalidValue
exception is thrwon. If mipLevel is not a valid mipmap level for the resource then ErrorInvalidValue
exception is thrwon. If the resource is not mapped then ErrorNotMapped exception is thrwon.
Declaration
public CUmipmappedArray GetMappedCUMipmappedArray()
Returns
| Type | Description |
|---|---|
| CUmipmappedArray |
GetMappedMipmappedArray(CUArrayFormat, CudaMipmappedArrayNumChannels)
Returns a CudaMipmappedArray through which the subresource of the mapped graphics resource resource which
corresponds to array index arrayIndex and mipmap level mipLevel may be accessed. The pointer value in CudaMipmappedArray
may change every time that resource is mapped.
If the resource is not a texture then it cannot be accessed via an array and ErrorNotMappedAsArray
exception is thrwon. If arrayIndex is not a valid array index for the resource then ErrorInvalidValue
exception is thrwon. If mipLevel is not a valid mipmap level for the resource then ErrorInvalidValue
exception is thrwon. If the resource is not mapped then ErrorNotMapped exception is thrwon.
Declaration
public CudaMipmappedArray GetMappedMipmappedArray(CUArrayFormat format, CudaMipmappedArrayNumChannels numChannels)
Parameters
| Type | Name | Description |
|---|---|---|
| CUArrayFormat | format | |
| CudaMipmappedArrayNumChannels | numChannels |
Returns
| Type | Description |
|---|---|
| CudaMipmappedArray |
GetMappedPointer()
Returns a CUdeviceptr, a device pointer through which the mapped graphics resource may be accessed.
The value set in devicePtr may
change every time that the resource is mapped.
If the resource is not a buffer then it cannot be accessed via a pointer and ErrorNotMappedAsPointer exception is thrown. If the resource is not mapped then ErrorNotMapped exception is thrown.
Declaration
public CUdeviceptr GetMappedPointer()
Returns
| Type | Description |
|---|---|
| CUdeviceptr |
GetMappedPointer(out CUdeviceptr, out SizeT)
Returns in devicePtr a pointer through which the mapped graphics resource may be accessed. Returns
in size the size of the memory in bytes which may be accessed from that pointer. The value set in devicePtr may
change every time that the resource is mapped.
If the resource is not a buffer then it cannot be accessed via a pointer and ErrorNotMappedAsPointer exception is thrown. If the resource is not mapped then ErrorNotMapped exception is thrown.
Declaration
public void GetMappedPointer(out CUdeviceptr devicePtr, out SizeT size)
Parameters
| Type | Name | Description |
|---|---|---|
| CUdeviceptr | devicePtr | |
| SizeT | size |
GetMappedPointer<T>()
Returns device variable through which the mapped graphics resource may be accessed.
The pointer value in the device variable may change every time that the resource is mapped.
If the resource is not a buffer then it cannot be accessed via a pointer and ErrorNotMappedAsPointer exception is thrown. If the resource is not mapped then ErrorNotMapped exception is thrown.
Declaration
public CudaDeviceVariable<T> GetMappedPointer<T>()
where T : struct
Returns
| Type | Description |
|---|---|
| CudaDeviceVariable<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
Map()
Maps the graphics resource for access by CUDA.
The resource may be accessed by CUDA until it is unmapped. The graphics API from which the resource was registered should not access any resources while they are mapped by CUDA. If an application does so, the results are undefined.
This function provides the synchronization guarantee that any graphics calls issued before Map()
will complete before any subsequent CUDA work issued in stream begins.
If the resource is presently mapped for access by CUDA then ErrorAlreadyMapped exception is thrown.
Declaration
public void Map()
Map(CUstream)
Maps the graphics resource for access by CUDA.
The resource may be accessed by CUDA until it is unmapped. The graphics API from which the resource was registered should not access any resources while they are mapped by CUDA. If an application does so, the results are undefined.
This function provides the synchronization guarantee that any graphics calls issued before Map()
will complete before any subsequent CUDA work issued in stream begins.
If the resource is presently mapped for access by CUDA then ErrorAlreadyMapped exception is thrown.
Declaration
public void Map(CUstream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| CUstream | stream |
SetIsMapped()
Declaration
public void SetIsMapped()
SetIsUnmapped()
Declaration
public void SetIsUnmapped()
SetMapFlags(CUGraphicsMapResourceFlags)
Set flags for mapping the graphics resource.
Changes to flags will take effect the next time resource is mapped. See CUGraphicsMapResourceFlags.
If resource is presently mapped for access by CUDA then ErrorAlreadyMapped exception is thrown.
Declaration
public void SetMapFlags(CUGraphicsMapResourceFlags flags)
Parameters
| Type | Name | Description |
|---|---|---|
| CUGraphicsMapResourceFlags | flags |
UnMap()
Unmaps the graphics resource.
Once unmapped, the resources in resources may not be accessed by CUDA until they are mapped again.
This function provides the synchronization guarantee that any CUDA work issued in stream before UnMap()
will complete before any subsequently issued graphics work begins.
If the resource is not presently mapped for access by CUDA then ErrorNotMapped exception is thrown.
Declaration
public void UnMap()
UnMap(CUstream)
Unmaps the graphics resource.
Once unmapped, the resource may not be accessed by CUDA until they are mapped again.
This function provides the synchronization guarantee that any CUDA work issued in stream before UnMap()
will complete before any subsequently issued graphics work begins.
If the resource is not presently mapped for access by CUDA then ErrorNotMapped exception is thrown.
Declaration
public void UnMap(CUstream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| CUstream | stream |
Unregister()
Unregisters the wrapped resource. Better use Dispose(), as the wrapper of the unregistered resource is of no use after unregistering.
Declaration
public void Unregister()