Skip to main content

cudaGraphicsResourceSetMapFlags

Function cudaGraphicsResourceSetMapFlags 

Source
pub unsafe extern "C" fn cudaGraphicsResourceSetMapFlags(
    resource: cudaGraphicsResource_t,
    flags: c_uint,
) -> cudaError_t
Expand description

Set usage flags for mapping a graphics resource.

Set flags for mapping the graphics resource resource.

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

  • cudaGraphicsMapFlagsNone: Specifies no hints about how resource will be used. It is therefore assumed that CUDA may read from or write to resource.
  • cudaGraphicsMapFlagsReadOnly: Specifies that CUDA will not write to resource.
  • cudaGraphicsMapFlagsWriteDiscard: Specifies CUDA will not read from resource and will write over the entire contents of resource, so none of the data previously stored in resource will be preserved.

If resource is presently mapped for access by CUDA then cudaError_t::CUDA_ERROR_UNKNOWN is returned. If flags is not one of the above values then cudaError_t::CUDA_ERROR_INVALID_VALUE is returned.

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

Note that this function may also return cudaError_t::CUDA_ERROR_NOT_INITIALIZED, cudaErrorInsufficientDriver or cudaError_t::CUDA_ERROR_NO_DEVICE if this call tries to initialize internal CUDA RT state.

Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback. cudaError_t::CUDA_ERROR_NOT_PERMITTED may, but is not guaranteed to, be returned as a diagnostic in such case.

§Parameters

  • resource: Registered resource to set flags for.
  • flags: Parameters for resource mapping.

§Return value

See also: cudaGraphicsMapResources, cuGraphicsResourceSetMapFlags.