PFND3D10DDI_CREATERESOURCE callback function

Creates a resource.


PFND3D10DDI_CREATERESOURCE Pfnd3d10ddiCreateresource;

void Pfnd3d10ddiCreateresource(



hDevice [in]

A handle to the display device (graphics context).


pCreateResource [in]

A pointer to a D3D10DDIARG_CREATERESOURCE structure that describes the parameters that the user-mode display driver uses to create a resource.


hResource [in]

A handle to the driver's private data for the resource. The driver returns the size, in bytes, of the memory region that the Microsoft Direct3D runtime must allocate for the private data from a call to the driver's CalcPrivateResourceSize function. The handle is actually just a pointer to a region of memory, the size of which the driver requested. The driver uses this region of memory to store internal data structures that are related to its resource object.


hRTResource [in]

A handle to the resource that the driver should use anytime it calls back into the Direct3D runtime.

Return Value


The driver can use the pfnSetErrorCb callback function to set an error code. For more information about setting error codes, see Remarks.


The driver might run out of memory. Therefore, the driver can pass E_OUTOFMEMORY or D3DDDIERR_DEVICEREMOVED in a call to the pfnSetErrorCb function. The driver can also pass DXGI_DDI_ERR_UNSUPPORTED in a call to pfnSetErrorCb. For more information about passing DXGI_DDI_ERR_UNSUPPORTED, see the Remarks section of the BltDXGI reference page. The Direct3D runtime will determine that any other errors are critical. If the driver passes any errors, including D3DDDIERR_DEVICEREMOVED, the Direct3D runtime will determine that the handle is invalid; therefore, the runtime will not call the DestroyResource(D3D10) function to destroy the handle that the hResource parameter specifies.

The runtime will validate all parameters against the parameters that an application sent to create the resource. Therefore, the driver should not receive invalid combinations.

If the application does not require the contents of the resource to persist across presentations, the runtime will set the D3D10_DDI_RESOURCE_MISC_DISCARD_ON_PRESENT flag of the D3D10_DDI_RESOURCE_MISC_FLAG enumeration in the MiscFlags member of the D3D10DDIARG_CREATERESOURCE structure that the pCreateResource parameter points to. Presentation occurs when the driver's PresentDXGI or BltDXGI (with the Present flag set in the DXGI_DDI_ARG_BLT_FLAGS structure) function is called. The runtime uses the D3D10_DDI_RESOURCE_MISC_DISCARD_ON_PRESENT flag to create swap-chain back buffers when an application uses the DXGI_SWAP_EFFECT_DISCARD value to request swap chains.

Creating a Stereo Back Buffer

Beginning in Windows 8, if the driver must create a stereo back buffer, it should set members of the D3D10DDIARG_CREATERESOURCE structure pointed to by pCreateResource as follows:

  1. Set the ArraySize member to a value of 2.
  2. Set the D3D10_DDI_BIND_PRESENT flag value in the BindFlags member.
Additionally, to support stereo presentation, the BltDXGI function must allow any values for the DstSubresource and SrcSubresource members of the DXGI_DDI_ARG_BLT structure that are within the range of the source and destination resources.


Minimum supported client Available in Windows Vista and later versions of the Windows operating systems.
Target Platform Desktop
Header d3d10umddi.h (include D3d10umddi.h)

See Also