Show / Hide Table of Contents

    Class DriverAPINativeMethods.GraphicsInterop

    Combines all graphics interop API calls

    Inheritance
    System.Object
    DriverAPINativeMethods.GraphicsInterop
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: ManagedCuda
    Assembly: ManagedCuda.dll
    Syntax
    public static class GraphicsInterop

    Methods

    cuGraphicsMapResources(UInt32, ref CUgraphicsResource, CUstream)

    Maps the count graphics resources in resources for access by CUDA.

    The resources in resources may be accessed by CUDA until they are unmapped. The graphics API from which resources were 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 cuGraphicsMapResources(UInt32, ref CUgraphicsResource, CUstream) will complete before any subsequent CUDA work issued in stream begins.

    If resources includes any duplicate entries then ErrorInvalidHandle is returned. If any of resources are presently mapped for access by CUDA then ErrorAlreadyMapped is returned.

    Declaration
    public static CUResult cuGraphicsMapResources(uint count, ref CUgraphicsResource resources, CUstream hStream)
    Parameters
    Type Name Description
    System.UInt32 count

    Number of resources to map. Here: must be 1

    CUgraphicsResource resources

    Resources to map for CUDA usage

    CUstream hStream

    Stream with which to synchronize

    Returns
    Type Description
    CUResult

    CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidHandle, ErrorAlreadyMapped, ErrorUnknown. Note that this function may also return error codes from previous, asynchronous launches.

    cuGraphicsMapResources(UInt32, CUgraphicsResource[], CUstream)

    Maps the count graphics resources in resources for access by CUDA.

    The resources in resources may be accessed by CUDA until they are unmapped. The graphics API from which resources were 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 cuGraphicsMapResources(UInt32, CUgraphicsResource[], CUstream) will complete before any subsequent CUDA work issued in stream begins.

    If resources includes any duplicate entries then ErrorInvalidHandle is returned. If any of resources are presently mapped for access by CUDA then ErrorAlreadyMapped is returned.

    Declaration
    public static CUResult cuGraphicsMapResources(uint count, CUgraphicsResource[] resources, CUstream hStream)
    Parameters
    Type Name Description
    System.UInt32 count

    Number of resources to map

    CUgraphicsResource[] resources

    Resources to map for CUDA usage

    CUstream hStream

    Stream with which to synchronize

    Returns
    Type Description
    CUResult

    CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidHandle, ErrorAlreadyMapped, ErrorUnknown. Note that this function may also return error codes from previous, asynchronous launches.

    cuGraphicsResourceGetMappedMipmappedArray(ref CUmipmappedArray, CUgraphicsResource)

    Returns in pMipmappedArray a mipmapped array through which the mapped graphics resource resource. The value set in pMipmappedArray may change every time that resource is mapped.

    If resource is not a texture then it cannot be accessed via a mipmapped array and ErrorNotMappedAsArray is returned. If resource is not mapped then ErrorNotMapped is returned.

    Declaration
    public static CUResult cuGraphicsResourceGetMappedMipmappedArray(ref CUmipmappedArray pMipmappedArray, CUgraphicsResource resource)
    Parameters
    Type Name Description
    CUmipmappedArray pMipmappedArray

    Returned mipmapped array through which resource may be accessed

    CUgraphicsResource resource

    Mapped resource to access

    Returns
    Type Description
    CUResult

    CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidHandle, ErrorNotMapped, ErrorNotMappedAsArray.

    cuGraphicsResourceGetMappedPointer_v2(ref CUdeviceptr, ref SizeT, CUgraphicsResource)

    Returns in pDevPtr a pointer through which the mapped graphics resource resource may be accessed. Returns in pSize the size of the memory in bytes which may be accessed from that pointer. The value set in pPointer may change every time that resource is mapped.

    If resource is not a buffer then it cannot be accessed via a pointer and ErrorNotMappedAsPointer is returned. If resource is not mapped then ErrorNotMapped is returned.

    Declaration
    public static CUResult cuGraphicsResourceGetMappedPointer_v2(ref CUdeviceptr pDevPtr, ref SizeT pSize, CUgraphicsResource resource)
    Parameters
    Type Name Description
    CUdeviceptr pDevPtr

    Returned pointer through which resource may be accessed

    SizeT pSize

    Returned size of the buffer accessible starting at pPointer

    CUgraphicsResource resource

    Mapped resource to access

    Returns
    Type Description
    CUResult

    CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidHandle, ErrorNotMapped, ErrorNotMappedAsPointer. Note that this function may also return error codes from previous, asynchronous launches.

    cuGraphicsResourceSetMapFlags(CUgraphicsResource, CUGraphicsMapResourceFlags)

    Set flags for mapping the graphics resource 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 is returned. If flags is not one of the CUGraphicsMapResourceFlags values then ErrorInvalidValue is returned.

    Declaration
    public static CUResult cuGraphicsResourceSetMapFlags(CUgraphicsResource resource, CUGraphicsMapResourceFlags flags)
    Parameters
    Type Name Description
    CUgraphicsResource resource

    Registered resource to set flags for

    CUGraphicsMapResourceFlags flags

    Parameters for resource mapping

    Returns
    Type Description
    CUResult

    CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidHandle, ErrorAlreadyMapped. Note that this function may also return error codes from previous, asynchronous launches.

    cuGraphicsSubResourceGetMappedArray(ref CUarray, CUgraphicsResource, UInt32, UInt32)

    Returns in pArray an array through which the subresource of the mapped graphics resource resource which corresponds to array index arrayIndex and mipmap level mipLevel may be accessed. The value set in pArray may change every time that resource is mapped.

    If resource is not a texture then it cannot be accessed via an array and ErrorNotMappedAsArray is returned. If arrayIndex is not a valid array index for resource then ErrorInvalidValue is returned. If mipLevel is not a valid mipmap level for resource then ErrorInvalidValue is returned. If resource is not mapped then ErrorNotMapped is returned.

    Declaration
    public static CUResult cuGraphicsSubResourceGetMappedArray(ref CUarray pArray, CUgraphicsResource resource, uint arrayIndex, uint mipLevel)
    Parameters
    Type Name Description
    CUarray pArray

    Returned array through which a subresource of resource may be accessed

    CUgraphicsResource resource

    Mapped resource to access

    System.UInt32 arrayIndex

    Array index for array textures or cubemap face index as defined by CUArrayCubemapFace for cubemap textures for the subresource to access

    System.UInt32 mipLevel

    Mipmap level for the subresource to access

    Returns
    Type Description
    CUResult

    CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidHandle, ErrorNotMapped, ErrorNotMappedAsArray. Note that this function may also return error codes from previous, asynchronous launches.

    cuGraphicsUnmapResources(UInt32, ref CUgraphicsResource, CUstream)

    Unmaps the count graphics resources in resources.

    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 cuGraphicsUnmapResources(UInt32, ref CUgraphicsResource, CUstream) will complete before any subsequently issued graphics work begins.

    If resources includes any duplicate entries then ErrorInvalidHandle is returned. If any of resources are not presently mapped for access by CUDA then ErrorNotMapped is returned.

    Declaration
    public static CUResult cuGraphicsUnmapResources(uint count, ref CUgraphicsResource resources, CUstream hStream)
    Parameters
    Type Name Description
    System.UInt32 count

    Number of resources to unmap. Here: must be 1

    CUgraphicsResource resources

    Resources to unmap

    CUstream hStream

    Stream with which to synchronize

    Returns
    Type Description
    CUResult

    CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidHandle, ErrorNotMapped, ErrorUnknown. Note that this function may also return error codes from previous, asynchronous launches.

    cuGraphicsUnmapResources(UInt32, CUgraphicsResource[], CUstream)

    Unmaps the count graphics resources in resources.

    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 cuGraphicsUnmapResources(UInt32, CUgraphicsResource[], CUstream) will complete before any subsequently issued graphics work begins.

    If resources includes any duplicate entries then ErrorInvalidHandle is returned. If any of resources are not presently mapped for access by CUDA then ErrorNotMapped is returned.

    Declaration
    public static CUResult cuGraphicsUnmapResources(uint count, CUgraphicsResource[] resources, CUstream hStream)
    Parameters
    Type Name Description
    System.UInt32 count

    Number of resources to unmap

    CUgraphicsResource[] resources

    Resources to unmap

    CUstream hStream

    Stream with which to synchronize

    Returns
    Type Description
    CUResult

    CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidHandle, ErrorNotMapped, ErrorUnknown. Note that this function may also return error codes from previous, asynchronous launches.

    cuGraphicsUnregisterResource(CUgraphicsResource)

    Unregisters the graphics resource resource so it is not accessible by CUDA unless registered again. If resource is invalid then ErrorInvalidHandle is returned.

    Declaration
    public static CUResult cuGraphicsUnregisterResource(CUgraphicsResource resource)
    Parameters
    Type Name Description
    CUgraphicsResource resource

    Resource to unregister

    Returns
    Type Description
    CUResult

    CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidContext, ErrorInvalidHandle, ErrorUnknown. Note that this function may also return error codes from previous, asynchronous launches.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX