Registers the Direct3D 11 resource pD3DResource
for access by CUDA and returns a CUDA handle to pD3Dresource
in pCudaResource
. The handle returned in pCudaResource
may be used to map and unmap this resource until it is unregistered. On success this call will increase the internal reference count on pD3DResource
. This reference count will be decremented when this resource is unregistered through cuGraphicsUnregisterResource().
This call is potentially high-overhead and should not be called every frame in interactive applications.
The type of pD3DResource
must be one of the following.
- ID3D11Buffer: may be accessed through a device pointer.
- ID3D11Texture1D: individual subresources of the texture may be accessed via arrays
- ID3D11Texture2D: individual subresources of the texture may be accessed via arrays
- ID3D11Texture3D: individual subresources of the texture may be accessed via arrays
The Flags
argument may be used to specify additional parameters at register time. The valid values for this parameter are
- CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this resource will be used.
- CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST: Specifies that CUDA will bind this resource to a surface reference.
Not all Direct3D resources of the above types may be used for interoperability with CUDA. The following are some limitations.
- The primary rendertarget may not be registered with CUDA.
- Resources allocated as shared may not be registered with CUDA.
- Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, or 32-bit integer or floating-point data cannot be shared.
- Surfaces of depth or stencil formats cannot be shared.
If Direct3D interoperability is not initialized for this context using cuD3D11CtxCreate then CUDA_ERROR_INVALID_CONTEXT is returned. If pD3DResource
is of incorrect type or is already registered then CUDA_ERROR_INVALID_HANDLE is returned. If pD3DResource
cannot be registered then CUDA_ERROR_UNKNOWN is returned. If Flags
is not one of the above specified value then CUDA_ERROR_INVALID_VALUE is returned.
- Parameters:
-
| pCudaResource | - Returned graphics resource handle |
| pD3DResource | - Direct3D resource to register |
| Flags | - Parameters for resource registration |
- Returns:
- CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_OUT_OF_MEMORY, CUDA_ERROR_UNKNOWN
- Note:
- Note that this function may also return error codes from previous, asynchronous launches.
- See also:
- cuD3D11CtxCreate, cuGraphicsUnregisterResource, cuGraphicsMapResources, cuGraphicsSubResourceGetMappedArray, cuGraphicsResourceGetMappedPointer