DirectX Graphics Documentation

CreateDXGIFactory1 function

Syntax


HRESULT CreateDXGIFactory1(
  REFIID  riid,
  void    **ppFactory
);
                

Parameters

riid
Type: REFIID
A globally unique identifier (GUID) for the factory interface. This parameter must be __uuidof(IDXGIFactory1) or __uuidof(IDXGIFactory2).

ppFactory
Type: void**
A pointer to a buffer that receives a pointer to the IDXGIFactory1 or IDXGIFactory2 interface.

Return value

Returns S_OK if the function succeeds and the GUIDs match. Returns DXGI_ERROR_INVALID_CALL if riid is not a valid GUID, or if ppFactory is NULL. Returns other standard COM error codes.

Remarks

The CreateDXGIFactory1 function creates a DXGI factory object. You can use the factory object to enumerate adapters and create swap chains. This function is similar to CreateDXGIFactory but allows you to get an IDXGIFactory1 or IDXGIFactory2 interface, which provides additional functionality.

For example, you can use the IDXGIFactory1 interface to enumerate adapters that support hardware stereoscopic 3D. You can use the IDXGIFactory2 interface to create a swap chain that supports variable refresh rate displays.

In most cases, you will pass __uuidof(IDXGIFactory1) for the riid parameter. If you need the features of IDXGIFactory2, you would pass __uuidof(IDXGIFactory2).

It is recommended to use CreateDXGIFactory2 in modern applications for better flexibility and control, especially when dealing with advanced features.

Requirements

Header

Declared in dxgi.h

Library

Link with dxgi.lib

Minimum supported client

Windows 7

Minimum supported server

Windows Server 2008 R2