MSDN Community

Understanding DXGI – DirectX Graphics Infrastructure

DXGI is a critical component for creating high‑performance graphics applications on Windows. It provides a bridge between Direct3D and the operating system’s compositing engine, handling tasks such as swap chain management, presentation, and inter‑process resource sharing.

Key Concepts

Sample Initialization

#include <dxgi1_6.h>
#include <d3d12.h>
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3d12.lib")

int main()
{
    IDXGIFactory6* factory = nullptr;
    CreateDXGIFactory2(0, IID_PPV_ARGS(&factory));

    IDXGIAdapter1* adapter = nullptr;
    for (UINT i = 0; factory->EnumAdapters1(i, &adapter) != DXGI_ERROR_NOT_FOUND; ++i)
    {
        DXGI_ADAPTER_DESC1 desc;
        adapter->GetDesc1(&desc);
        if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) continue;
        // Choose the first hardware adapter
        break;
    }

    ID3D12Device* device = nullptr;
    D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&device));

    // ... Create command queue, swap chain, etc.
    return 0;
}

For a full walkthrough, see the official documentation.

Comments (3)

Jane Doe · Sep 10, 2025
Great overview! I struggled with swap chain creation until I found this.
Mike Smith · Sep 11, 2025
Don’t forget to enable HDR on compatible displays.
Alex Lee · Sep 12, 2025
Can anyone share resources about multi‑GPU setups with DXGI?