This section describes the graphics interoperability functions of the CUDA runtime application programming interface.
Maps thecount graphics resources inresources for access by CUDA.
The resources inresources may be accessed by CUDA until they are unmapped. The graphics API from whichresources 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 beforecudaGraphicsMapResources() will complete before any subsequent CUDA work issued instream begins.
Ifresources contains any duplicate entries thencudaErrorInvalidResourceHandle is returned. If any ofresources are presently mapped for access by CUDA thencudaErrorUnknown is returned.
This function uses standarddefault stream semantics.
Note that this function may also return error codes from previous, asynchronous launches.
Note that this function may also returncudaErrorInitializationError,cudaErrorInsufficientDriver orcudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
Note that as specified bycudaStreamAddCallback no CUDA function may be called from callback.cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphicsResourceGetMappedPointer,cudaGraphicsSubResourceGetMappedArray,cudaGraphicsUnmapResources,cuGraphicsMapResources
Returns in*mipmappedArray a mipmapped array through which the mapped graphics resourceresource may be accessed. The value set inmipmappedArray may change every time thatresource is mapped.
Ifresource is not a texture then it cannot be accessed via an array andcudaErrorUnknown is returned. Ifresource is not mapped thencudaErrorUnknown is returned.
Note that this function may also return error codes from previous, asynchronous launches.
Note that this function may also returncudaErrorInitializationError,cudaErrorInsufficientDriver orcudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
Note that as specified bycudaStreamAddCallback no CUDA function may be called from callback.cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphicsResourceGetMappedPointer,cuGraphicsResourceGetMappedMipmappedArray
Returns in*devPtr a pointer through which the mapped graphics resourceresource may be accessed. Returns in*size the size of the memory in bytes which may be accessed from that pointer. The value set indevPtr may change every time thatresource is mapped.
Ifresource is not a buffer then it cannot be accessed via a pointer andcudaErrorUnknown is returned. Ifresource is not mapped thencudaErrorUnknown is returned. *
Note that this function may also return error codes from previous, asynchronous launches.
Note that this function may also returncudaErrorInitializationError,cudaErrorInsufficientDriver orcudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
Note that as specified bycudaStreamAddCallback no CUDA function may be called from callback.cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphicsMapResources,cudaGraphicsSubResourceGetMappedArray,cuGraphicsResourceGetMappedPointer
Setflags for mapping the graphics resourceresource.
Changes toflags will take effect the next timeresource is mapped. Theflags argument may be any of the following:
cudaGraphicsMapFlagsNone: Specifies no hints about howresource will be used. It is therefore assumed that CUDA may read from or write toresource.
cudaGraphicsMapFlagsReadOnly: Specifies that CUDA will not write toresource.
cudaGraphicsMapFlagsWriteDiscard: Specifies CUDA will not read fromresource and will write over the entire contents ofresource, so none of the data previously stored inresource will be preserved.
Ifresource is presently mapped for access by CUDA thencudaErrorUnknown is returned. Ifflags is not one of the above values thencudaErrorInvalidValue is returned.
Note that this function may also return error codes from previous, asynchronous launches.
Note that this function may also returncudaErrorInitializationError,cudaErrorInsufficientDriver orcudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
Note that as specified bycudaStreamAddCallback no CUDA function may be called from callback.cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
Returns in*array an array through which the subresource of the mapped graphics resourceresource which corresponds to array indexarrayIndex and mipmap levelmipLevel may be accessed. The value set inarray may change every time thatresource is mapped.
Ifresource is not a texture then it cannot be accessed via an array andcudaErrorUnknown is returned. IfarrayIndex is not a valid array index forresource thencudaErrorInvalidValue is returned. IfmipLevel is not a valid mipmap level forresource thencudaErrorInvalidValue is returned. Ifresource is not mapped thencudaErrorUnknown is returned.
Note that this function may also return error codes from previous, asynchronous launches.
Note that this function may also returncudaErrorInitializationError,cudaErrorInsufficientDriver orcudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
Note that as specified bycudaStreamAddCallback no CUDA function may be called from callback.cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphicsResourceGetMappedPointer,cuGraphicsSubResourceGetMappedArray
Unmaps thecount graphics resources inresources.
Once unmapped, the resources inresources may not be accessed by CUDA until they are mapped again.
This function provides the synchronization guarantee that any CUDA work issued instream beforecudaGraphicsUnmapResources() will complete before any subsequently issued graphics work begins.
Ifresources contains any duplicate entries thencudaErrorInvalidResourceHandle is returned. If any ofresources are not presently mapped for access by CUDA thencudaErrorUnknown is returned.
This function uses standarddefault stream semantics.
Note that this function may also return error codes from previous, asynchronous launches.
Note that this function may also returncudaErrorInitializationError,cudaErrorInsufficientDriver orcudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
Note that as specified bycudaStreamAddCallback no CUDA function may be called from callback.cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
Unregisters the graphics resourceresource so it is not accessible by CUDA unless registered again.
Ifresource is invalid thencudaErrorInvalidResourceHandle is returned.
Note that this function may also return error codes from previous, asynchronous launches.
Note that this function may also returncudaErrorInitializationError,cudaErrorInsufficientDriver orcudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
Note that as specified bycudaStreamAddCallback no CUDA function may be called from callback.cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
Use of the handle after this call is undefined behavior.
See also:
cudaGraphicsD3D9RegisterResource,cudaGraphicsD3D10RegisterResource,cudaGraphicsD3D11RegisterResource,cudaGraphicsGLRegisterBuffer,cudaGraphicsGLRegisterImage,cuGraphicsUnregisterResource