Show / Hide Table of Contents

    Class OpenGLNativeMethods.CUDA3

    OpenGL Interoperability for CUDA >3.x

    Inheritance
    System.Object
    OpenGLNativeMethods.CUDA3
    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 CUDA3

    Methods

    cuGLCtxCreate(ref CUcontext, CUCtxFlags, CUdevice)

    Creates a new CUDA context, initializes OpenGL interoperability, and associates the CUDA context with the calling thread. It must be called before performing any other OpenGL interoperability operations. It may fail if the needed OpenGL driver facilities are not available. For usage of the Flags parameter, see cuCtxCreate_v2(ref CUcontext, CUCtxFlags, CUdevice).

    Declaration
    public static CUResult cuGLCtxCreate(ref CUcontext pCtx, CUCtxFlags Flags, CUdevice device)
    Parameters
    Type Name Description
    CUcontext pCtx

    Returned CUDA context

    CUCtxFlags Flags

    Options for CUDA context creation

    CUdevice device

    Device on which to create the context

    Returns
    Type Description
    CUResult

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

    cuGLGetDevices(ref UInt32, CUdevice[], UInt32, CUGLDeviceList)

    Gets the CUDA devices associated with the current OpenGL context.

    Returns in pCudaDeviceCount the number of CUDA-compatible devices corresponding to the current OpenGL context. Also returns in pCudaDevices at most cudaDeviceCount of the CUDA-compatible devices corresponding to the current OpenGL context. If any of the GPUs being used by the current OpenGL context are not CUDA capable then the call will return CUDA_ERROR_NO_DEVICE.

    Declaration
    public static CUResult cuGLGetDevices(ref uint pCudaDeviceCount, CUdevice[] pCudaDevices, uint cudaDeviceCount, CUGLDeviceList deviceList)
    Parameters
    Type Name Description
    System.UInt32 pCudaDeviceCount

    Returned number of CUDA devices.

    CUdevice[] pCudaDevices

    Returned CUDA devices.

    System.UInt32 cudaDeviceCount

    The size of the output device array pCudaDevices.

    CUGLDeviceList deviceList

    The set of devices to return.

    Returns
    Type Description
    CUResult

    cuGraphicsGLRegisterBuffer(ref CUgraphicsResource, UInt32, CUGraphicsRegisterFlags)

    Registers the buffer object specified by buffer for access by CUDA. A handle to the registered object is returned as pCudaResource. The map flags Flags specify the intended usage.

    Declaration
    public static CUResult cuGraphicsGLRegisterBuffer(ref CUgraphicsResource pCudaResource, uint buffer, CUGraphicsRegisterFlags Flags)
    Parameters
    Type Name Description
    CUgraphicsResource pCudaResource

    Pointer to the returned object handle

    System.UInt32 buffer

    name of buffer object to be registered

    CUGraphicsRegisterFlags Flags

    Map flags

    Returns
    Type Description
    CUResult

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

    cuGraphicsGLRegisterImage(ref CUgraphicsResource, UInt32, CudaOpenGLImageInteropResource.OpenGLImageTarget, CUGraphicsRegisterFlags)

    Registers the texture or renderbuffer object specified by image for access by CUDA. target must match the type of the object. A handle to the registered object is returned as pCudaResource. The map flags Flags specify the intended usage.

    The following image classes are currently disallowed:

    • Textures with borders

    • Multisampled renderbuffers

    Declaration
    public static CUResult cuGraphicsGLRegisterImage(ref CUgraphicsResource pCudaResource, uint image, CudaOpenGLImageInteropResource.OpenGLImageTarget target, CUGraphicsRegisterFlags Flags)
    Parameters
    Type Name Description
    CUgraphicsResource pCudaResource

    Pointer to the returned object handle

    System.UInt32 image

    name of texture or renderbuffer object to be registered

    CudaOpenGLImageInteropResource.OpenGLImageTarget target

    Identifies the type of object specified by image, and must be one of GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_3D, GL_TEXTURE_2D_ARRAY, or GL_RENDERBUFFER.

    CUGraphicsRegisterFlags Flags

    Map flags

    Returns
    Type Description
    CUResult

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

    cuWGLGetDevice(ref CUdevice, IntPtr)

    Returns in pDevice the CUDA device associated with a hGpu, if applicable.

    Declaration
    public static CUResult cuWGLGetDevice(ref CUdevice pDevice, IntPtr hGpu)
    Parameters
    Type Name Description
    CUdevice pDevice

    Device associated with hGpu

    System.IntPtr hGpu

    Handle to a GPU, as queried via WGL_NV_gpu_affinity()

    Returns
    Type Description
    CUResult

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

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