CUresult cuGraphicsD3D9RegisterResource ( CUgraphicsResource pCudaResource,
IDirect3DResource9 *  pD3DResource,
unsigned int  Flags 
)

Registers the Direct3D 9 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.

  • IDirect3DVertexBuffer9: may be accessed through a device pointer
  • IDirect3DIndexBuffer9: may be accessed through a device pointer
  • IDirect3DSurface9: may be accessed through an array. Only stand-alone objects of type IDirect3DSurface9 may be explicitly shared. In particular, individual mipmap levels and faces of cube maps may not be registered directly. To access individual surfaces associated with a texture, one must register the base texture object.
  • IDirect3DBaseTexture9: individual surfaces on this texture may be accessed through an array.

The Flags argument may be used to specify additional parameters at register time. The only valid value for this parameter is

  • CU_GRAPHICS_REGISTER_FLAGS_NONE

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 cuD3D9CtxCreate 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:
cuD3D9CtxCreate, cuGraphicsUnregisterResource, cuGraphicsMapResources, cuGraphicsSubResourceGetMappedArray, cuGraphicsResourceGetMappedPointer


Generated by Doxygen for NVIDIA CUDA Library  NVIDIA