3.11. OpenGL Interoperability [DEPRECATED]

This section describes deprecated OpenGL interoperability functionality.

Enumerations

enum cudaGLMapFlags

Functions

cudaError_t cudaGLMapBufferObject ( void** devPtr, GLuint bufObj )
Maps a buffer object for access by CUDA.
cudaError_t cudaGLMapBufferObjectAsync ( void** devPtr, GLuint bufObj, cudaStream_t stream )
Maps a buffer object for access by CUDA.
cudaError_t cudaGLRegisterBufferObject ( GLuint bufObj )
Registers a buffer object for access by CUDA.
cudaError_t cudaGLSetBufferObjectMapFlags ( GLuint bufObj, unsigned int  flags )
Set usage flags for mapping an OpenGL buffer.
cudaError_t cudaGLSetGLDevice ( int  device )
Sets a CUDA device to use OpenGL interoperability.
cudaError_t cudaGLUnmapBufferObject ( GLuint bufObj )
Unmaps a buffer object for access by CUDA.
cudaError_t cudaGLUnmapBufferObjectAsync ( GLuint bufObj, cudaStream_t stream )
Unmaps a buffer object for access by CUDA.
cudaError_t cudaGLUnregisterBufferObject ( GLuint bufObj )
Unregisters a buffer object for access by CUDA.

Enumerations

enum cudaGLMapFlags

CUDA GL Map Flags

Values
cudaGLMapFlagsNone = 0
Default; Assume resource can be read/written
cudaGLMapFlagsReadOnly = 1
CUDA kernels will not write to this resource
cudaGLMapFlagsWriteDiscard = 2
CUDA kernels will only write to and will not read from this resource

Functions

cudaError_t cudaGLMapBufferObject ( void** devPtr, GLuint bufObj )
Maps a buffer object for access by CUDA.
Parameters
devPtr
- Returned device pointer to CUDA object
bufObj
- Buffer object ID to map
Deprecated

This function is deprecated as of CUDA 3.0.

Description

Maps the buffer object of ID bufObj into the address space of CUDA and returns in *devPtr the base pointer of the resulting mapping. The buffer must have previously been registered by calling cudaGLRegisterBufferObject(). While a buffer is mapped by CUDA, any OpenGL operation which references the buffer will result in undefined behavior. The OpenGL context used to create the buffer, or another context from the same share group, must be bound to the current thread when this is called.

All streams in the current thread are synchronized with the current GL context.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaGraphicsMapResources

cudaError_t cudaGLMapBufferObjectAsync ( void** devPtr, GLuint bufObj, cudaStream_t stream )
Maps a buffer object for access by CUDA.
Parameters
devPtr
- Returned device pointer to CUDA object
bufObj
- Buffer object ID to map
stream
- Stream to synchronize
Deprecated

This function is deprecated as of CUDA 3.0.

Description

Maps the buffer object of ID bufObj into the address space of CUDA and returns in *devPtr the base pointer of the resulting mapping. The buffer must have previously been registered by calling cudaGLRegisterBufferObject(). While a buffer is mapped by CUDA, any OpenGL operation which references the buffer will result in undefined behavior. The OpenGL context used to create the buffer, or another context from the same share group, must be bound to the current thread when this is called.

Stream /p stream is synchronized with the current GL context.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaGraphicsMapResources

cudaError_t cudaGLRegisterBufferObject ( GLuint bufObj )
Registers a buffer object for access by CUDA.
Parameters
bufObj
- Buffer object ID to register
Deprecated

This function is deprecated as of CUDA 3.0.

Description

Registers the buffer object of ID bufObj for access by CUDA. This function must be called before CUDA can map the buffer object. The OpenGL context used to create the buffer, or another context from the same share group, must be bound to the current thread when this is called.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaGraphicsGLRegisterBuffer

cudaError_t cudaGLSetBufferObjectMapFlags ( GLuint bufObj, unsigned int  flags )
Set usage flags for mapping an OpenGL buffer.
Parameters
bufObj
- Registered buffer object to set flags for
flags
- Parameters for buffer mapping
Deprecated

This function is deprecated as of CUDA 3.0.

Description

Set flags for mapping the OpenGL buffer bufObj

Changes to flags will take effect the next time bufObj is mapped. The flags argument may be any of the following:

  • cudaGLMapFlagsNone: Specifies no hints about how this buffer will be used. It is therefore assumed that this buffer will be read from and written to by CUDA kernels. This is the default value.

  • cudaGLMapFlagsReadOnly: Specifies that CUDA kernels which access this buffer will not write to the buffer.

  • cudaGLMapFlagsWriteDiscard: Specifies that CUDA kernels which access this buffer will not read from the buffer and will write over the entire contents of the buffer, so none of the data previously stored in the buffer will be preserved.

If bufObj has not been registered for use with CUDA, then cudaErrorInvalidResourceHandle is returned. If bufObj is presently mapped for access by CUDA, then cudaErrorUnknown is returned.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaGraphicsResourceSetMapFlags

cudaError_t cudaGLSetGLDevice ( int  device )
Sets a CUDA device to use OpenGL interoperability.
Parameters
device
- Device to use for OpenGL interoperability
Deprecated

This function is deprecated as of CUDA 5.0.

Description

This function is deprecated and should no longer be used. It is no longer necessary to associate a CUDA device with an OpenGL context in order to achieve maximum interoperability performance.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaGraphicsGLRegisterBuffer, cudaGraphicsGLRegisterImage

cudaError_t cudaGLUnmapBufferObject ( GLuint bufObj )
Unmaps a buffer object for access by CUDA.
Parameters
bufObj
- Buffer object to unmap
Deprecated

This function is deprecated as of CUDA 3.0.

Description

Unmaps the buffer object of ID bufObj for access by CUDA. When a buffer is unmapped, the base address returned by cudaGLMapBufferObject() is invalid and subsequent references to the address result in undefined behavior. The OpenGL context used to create the buffer, or another context from the same share group, must be bound to the current thread when this is called.

All streams in the current thread are synchronized with the current GL context.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaGraphicsUnmapResources

cudaError_t cudaGLUnmapBufferObjectAsync ( GLuint bufObj, cudaStream_t stream )
Unmaps a buffer object for access by CUDA.
Parameters
bufObj
- Buffer object to unmap
stream
- Stream to synchronize
Deprecated

This function is deprecated as of CUDA 3.0.

Description

Unmaps the buffer object of ID bufObj for access by CUDA. When a buffer is unmapped, the base address returned by cudaGLMapBufferObject() is invalid and subsequent references to the address result in undefined behavior. The OpenGL context used to create the buffer, or another context from the same share group, must be bound to the current thread when this is called.

Stream /p stream is synchronized with the current GL context.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaGraphicsUnmapResources

cudaError_t cudaGLUnregisterBufferObject ( GLuint bufObj )
Unregisters a buffer object for access by CUDA.
Parameters
bufObj
- Buffer object to unregister
Returns

cudaSuccess

Deprecated

This function is deprecated as of CUDA 3.0.

Description

Unregisters the buffer object of ID bufObj for access by CUDA and releases any CUDA resources associated with the buffer. Once a buffer is unregistered, it may no longer be mapped by CUDA. The GL context used to create the buffer, or another context from the same share group, must be bound to the current thread when this is called.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaGraphicsUnregisterResource