6.29. OpenGL Interoperability [DEPRECATED]
This section describes deprecated OpenGL interoperability functionality.
Enumerations
- cudaGLMapFlags
CUDA GL Map Flags.
Functions
- __host__ cudaError_t cudaGLMapBufferObject(void **devPtr, GLuint bufObj)
Maps a buffer object for access by CUDA.
- __host__ cudaError_t cudaGLMapBufferObjectAsync(void **devPtr, GLuint bufObj, cudaStream_t stream)
Maps a buffer object for access by CUDA.
- __host__ cudaError_t cudaGLRegisterBufferObject(GLuint bufObj)
Registers a buffer object for access by CUDA.
- __host__ cudaError_t cudaGLSetBufferObjectMapFlags(GLuint bufObj, unsigned int flags)
Set usage flags for mapping an OpenGL buffer.
- __host__ cudaError_t cudaGLSetGLDevice(int device)
Sets a CUDA device to use OpenGL interoperability.
- __host__ cudaError_t cudaGLUnmapBufferObject(GLuint bufObj)
Unmaps a buffer object for access by CUDA.
- __host__ cudaError_t cudaGLUnmapBufferObjectAsync(GLuint bufObj, cudaStream_t stream)
Unmaps a buffer object for access by CUDA.
- __host__ cudaError_t cudaGLUnregisterBufferObject(GLuint bufObj)
Unregisters a buffer object for access by CUDA.
6.29.1. Enumerations
-
enum cudaGLMapFlags
CUDA GL Map Flags.
Values:
-
enumerator cudaGLMapFlagsNone
Default; Assume resource can be read/written.
-
enumerator cudaGLMapFlagsReadOnly
CUDA kernels will not write to this resource.
-
enumerator cudaGLMapFlagsWriteDiscard
CUDA kernels will only write to and will not read from this resource.
-
enumerator cudaGLMapFlagsNone
6.29.2. Functions
-
__host__ cudaError_t cudaGLMapBufferObject(void **devPtr, GLuint bufObj)
Maps a buffer object for access by CUDA.
- Deprecated:
This function is deprecated as of CUDA 3.0.
Maps the buffer object of ID
bufObjinto the address space of CUDA and returns in*devPtrthe 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.
See also
Note
Note that this function may also return error codes from previous, asynchronous launches.
- Parameters
devPtr – - Returned device pointer to CUDA object
bufObj – - Buffer object ID to map
- Returns
-
__host__ cudaError_t cudaGLMapBufferObjectAsync(void **devPtr, GLuint bufObj, cudaStream_t stream)
Maps a buffer object for access by CUDA.
- Deprecated:
This function is deprecated as of CUDA 3.0.
Maps the buffer object of ID
bufObjinto the address space of CUDA and returns in*devPtrthe 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.
See also
Note
Note that this function may also return error codes from previous, asynchronous launches.
- Parameters
devPtr – - Returned device pointer to CUDA object
bufObj – - Buffer object ID to map
stream – - Stream to synchronize
- Returns
-
__host__ cudaError_t cudaGLRegisterBufferObject(GLuint bufObj)
Registers a buffer object for access by CUDA.
- Deprecated:
This function is deprecated as of CUDA 3.0.
Registers the buffer object of ID
bufObjfor 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.See also
Note
Note that this function may also return error codes from previous, asynchronous launches.
- Parameters
bufObj – - Buffer object ID to register
- Returns
-
__host__ cudaError_t cudaGLSetBufferObjectMapFlags(GLuint bufObj, unsigned int flags)
Set usage flags for mapping an OpenGL buffer.
- Deprecated:
This function is deprecated as of CUDA 3.0.
Set flags for mapping the OpenGL buffer
bufObjChanges to flags will take effect the next time
bufObjis mapped. Theflagsargument 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
bufObjhas not been registered for use with CUDA, then cudaErrorInvalidResourceHandle is returned. IfbufObjis presently mapped for access by CUDA, then cudaErrorUnknown is returned.See also
Note
Note that this function may also return error codes from previous, asynchronous launches.
- Parameters
bufObj – - Registered buffer object to set flags for
flags – - Parameters for buffer mapping
- Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle, cudaErrorUnknown
-
__host__ cudaError_t cudaGLSetGLDevice(int device)
Sets a CUDA device to use OpenGL interoperability.
- Deprecated:
This function is deprecated as of CUDA 5.0.
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.
This function will immediately initialize the primary context on
deviceif needed.Note
Note that this function may also return error codes from previous, asynchronous launches.
- Parameters
device – - Device to use for OpenGL interoperability
- Returns
cudaSuccess, cudaErrorInvalidDevice, cudaErrorSetOnActiveProcess
-
__host__ cudaError_t cudaGLUnmapBufferObject(GLuint bufObj)
Unmaps a buffer object for access by CUDA.
- Deprecated:
This function is deprecated as of CUDA 3.0.
Unmaps the buffer object of ID
bufObjfor 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.
See also
Note
Note that this function may also return error codes from previous, asynchronous launches.
- Parameters
bufObj – - Buffer object to unmap
- Returns
-
__host__ cudaError_t cudaGLUnmapBufferObjectAsync(GLuint bufObj, cudaStream_t stream)
Unmaps a buffer object for access by CUDA.
- Deprecated:
This function is deprecated as of CUDA 3.0.
Unmaps the buffer object of ID
bufObjfor 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.
See also
Note
Note that this function may also return error codes from previous, asynchronous launches.
- Parameters
bufObj – - Buffer object to unmap
stream – - Stream to synchronize
- Returns
-
__host__ cudaError_t cudaGLUnregisterBufferObject(GLuint bufObj)
Unregisters a buffer object for access by CUDA.
- Deprecated:
This function is deprecated as of CUDA 3.0.
Unregisters the buffer object of ID
bufObjfor 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.See also
Note
Note that this function may also return error codes from previous, asynchronous launches.
- Parameters
bufObj – - Buffer object to unregister
- Returns