Skip to main content

cuGraphicsResourceSetMapFlags_v2

Function cuGraphicsResourceSetMapFlags_v2 

Source
pub unsafe extern "C" fn cuGraphicsResourceSetMapFlags_v2(
    resource: CUgraphicsResource,
    flags: c_uint,
) -> CUresult
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:

  • CUgraphicsMapResourceFlags::CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE: Specifies no hints about how this resource will be used. It is therefore assumed that this resource will be read from and written to by CUDA kernels. This is the default value.
  • CU_GRAPHICS_MAP_RESOURCE_FLAGS_READONLY: Specifies that CUDA kernels which access this resource will not write to this resource.
  • CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITEDISCARD: Specifies that CUDA kernels which access this resource will not read from this resource and will write over the entire contents of the resource, so none of the data previously stored in the resource will be preserved.

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

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

§Parameters

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

§Return value

See also: cuGraphicsMapResources, cudaGraphicsResourceSetMapFlags.