PFND3D11DDI_CREATERESOURCE callback function (d3d10umddi.h)
Creates a resource.
Syntax
PFND3D11DDI_CREATERESOURCE Pfnd3d11ddiCreateresource;
void Pfnd3d11ddiCreateresource(
D3D10DDI_HDEVICE unnamedParam1,
const D3D11DDIARG_CREATERESOURCE *unnamedParam2,
D3D10DDI_HRESOURCE unnamedParam3,
D3D10DDI_HRTRESOURCE unnamedParam4
)
{...}
Parameters
unnamedParam1
hDevice [in]
A handle to the display device (graphics context).
unnamedParam2
pCreateResource [in]
A pointer to a D3D11DDIARG_CREATERESOURCE structure that describes the parameters that the user-mode display driver uses to create a resource.
unnamedParam3
hResource [in]
A handle to the driver's private data for the resource.
unnamedParam4
hRTResource [in]
A handle to the resource that the driver will use when it calls back into the Direct3D runtime.
Return value
None
Remarks
The driver can use the pfnSetErrorCb callback function to set an error code.
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 determines that any other errors are critical. If the driver passes any errors, which includes D3DDDIERR_DEVICEREMOVED, the Direct3D runtime determines that the handle is invalid; therefore, the runtime does not call the DestroyResource(D3D10) function to destroy the handle that the hResource parameter specifies.
The runtime validates 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 sets the D3D10_DDI_RESOURCE_MISC_DISCARD_ON_PRESENT flag of the D3D10_DDI_RESOURCE_MISC_FLAG enumeration in the MiscFlags member of the D3D11DDIARG_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
Starting in Windows 8, if the driver must create a stereo back buffer, it must set members of the D3D11DDIARG_CREATERESOURCE structure pointed to by pCreateResource as follows:- Set the ArraySize member to a value of 2.
- Set the D3D10_DDI_BIND_PRESENT flag value in the BindFlags member.
Restrictions on input values
For Windows Display Driver Model (WDDM) 1.3 and later drivers, the Microsoft Direct3D runtime supplies a restricted set of input values used by this function. For a list of all restricted values, see [Direct3D rendering performance improvements](/windows-hardware/drivers/display/direct3d-rendering-performance-improvements).Requirements
Requirement | Value |
---|---|
Minimum supported client | CreateResource(D3D11) is supported beginning with the Windows 7 operating system. |
Target Platform | Desktop |
Header | d3d10umddi.h (include D3d10umddi.h) |