DXGI Functions

This section provides detailed documentation for the functions available in the DirectX Graphics Infrastructure (DXGI) API. DXGI is responsible for managing graphics adapters, swap chains, and other essential graphics-related operations.

Core DXGI Functions

CreateDXGIFactory1

Creates an instance of the DXGI factory. Use this factory to enumerate adapters and create swap chains.

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

Enables the operating system to notify your application when a graphics adapter is removed. This is crucial for graceful handling of adapter hot-plugging or removal events.

void DXGIDeclareAdapterRemovalSupport();
DXGIReportAdapterConfiguration

Reports the current configuration of a graphics adapter to the DXGI runtime. This function is primarily used by device drivers.

void DXGIReportAdapterConfiguration();

Adapter Enumeration and Information

IDXGIFactory::EnumAdapters

Enumerates the graphics adapters available on the system. Each adapter represents a physical or virtual graphics card.

HRESULT EnumAdapters(UINT Adapter, IDXGIAdapter **ppAdapter);
IDXGIFactory1::EnumAdapters1

Enumerates the graphics adapters available on the system, providing additional information compared to EnumAdapters.

HRESULT EnumAdapters1(UINT Adapter, IDXGIAdapter1 **ppAdapter);
IDXGIAdapter::GetDesc

Retrieves a description of the graphics adapter, including its name and device identifiers.

HRESULT GetDesc(DXGI_ADAPTER_DESC *pDesc);
IDXGIAdapter1::GetDesc1

Retrieves an extended description of the graphics adapter, including memory information.

HRESULT GetDesc1(DXGI_ADAPTER_DESC1 *pDesc);

Swap Chain Management

IDXGIFactory::CreateSwapChain

Creates a new swap chain. A swap chain is a queue of buffers that holds the frames to be presented to the output.

HRESULT CreateSwapChain(IUnknown *pDevice, DXGI_SWAP_CHAIN_DESC *pDesc, IDXGISwapChain **ppSwapChain);
IDXGIFactory2::CreateSwapChainForHwnd

Creates a swap chain associated with a specific window handle (HWND).

HRESULT CreateSwapChainForHwnd(IUnknown *pDevice, HWND hWnd, const DXGI_SWAP_CHAIN_DESC1 *pDesc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pFullscreenDesc, IDXGIOutput *pRestrictToOutput, IDXGISwapChain1 **ppSwapChain);
IDXGISwapChain::Present

Presents the next frame in the swap chain to the user.

HRESULT Present(UINT SyncInterval, UINT Flags);
IDXGISwapChain::GetDesc

Retrieves the description of the swap chain.

HRESULT GetDesc(DXGI_SWAP_CHAIN_DESC *pDesc);

Other Utility Functions

DXGI_FORMAT_SUPPORT1

Checks for support of specific formats and capabilities. (Note: This is an enum flag, often used with CheckFormatSupport).

enum DXGI_FORMAT_SUPPORT1 : UINT;
IDXGIFactory::MakeWindowAssociation

Specifies how DXGI should handle window messages, such as Alt+Enter for fullscreen toggling.

HRESULT MakeWindowAssociation(HWND WindowHandle, UINT Flags);

For more in-depth details on specific function parameters, return values, and usage examples, please refer to the relevant interface documentation.