CreateDXGIFactory2 function (dxgi1_3.h)

Creates a DXGI 1.3 factory that you can use to generate other DXGI objects.

In Windows 8, any DXGI factory created while DXGIDebug.dll was present on the system would load and use it. Starting in Windows 8.1, apps explicitly request that DXGIDebug.dll be loaded instead. Use CreateDXGIFactory2 and specify the DXGI_CREATE_FACTORY_DEBUG flag to request DXGIDebug.dll; the DLL will be loaded if it is present on the system.


HRESULT CreateDXGIFactory2(
        UINT   Flags,
        REFIID riid,
  [out] void   **ppFactory



Type: UINT

Valid values include the DXGI_CREATE_FACTORY_DEBUG (0x01) flag, and zero.

Note  This flag will be set by the D3D runtime if:
  • The system creates an implicit factory during device creation.
  • The D3D11_CREATE_DEVICE_DEBUG flag is specified during device creation, for example using D3D11CreateDevice (or the swapchain method, or the Direct3D 10 equivalents).



The globally unique identifier (GUID) of the IDXGIFactory2 object referenced by the ppFactory parameter.

[out] ppFactory

Type: void**

Address of a pointer to an IDXGIFactory2 object.

Return value


Returns S_OK if successful; an error code otherwise. For a list of error codes, see DXGI_ERROR.


This function accepts a flag indicating whether DXGIDebug.dll is loaded. The function otherwise behaves identically to CreateDXGIFactory1.


Minimum supported client Windows 8.1 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 R2 [desktop apps | UWP apps]
Target Platform Windows
Header dxgi1_3.h
Library DXGI.lib
DLL Dxgi.dll

See also

DXGI Functions