DirectX Graphics Infrastructure (DXGI)
The DirectX Graphics Infrastructure (DXGI) provides the foundation for graphics on Windows. It handles tasks such as enumerating display adapters, managing output, presenting frames, and sharing graphics resources between applications and the system.
DXGI works in conjunction with Direct3D to provide a comprehensive graphics pipeline. Understanding DXGI is crucial for developing efficient and high-performance graphics applications on the Windows platform.
Key Concepts
DXGI introduces several fundamental concepts that are essential for graphics development:
- Adapters: Represent graphics hardware, such as GPUs. DXGI allows you to enumerate available adapters and query their capabilities.
- Outputs: Represent the display monitors connected to an adapter. You can query information about outputs like their resolution, refresh rate, and monitor handle.
- Swap Chains: A mechanism for presenting rendered frames to the display. A swap chain consists of one or more buffers that are cycled through to display the rendered image.
- Resource Sharing: DXGI facilitates the sharing of graphics resources (like textures and surfaces) between different Direct3D devices or even between applications, using features like NT handles.
- Frame Presentation: Controls how and when rendered frames are displayed, including options for vsync and multi-sampling.
API Reference
The DXGI API provides a set of interfaces and functions for managing graphics hardware and presentation. Here are some of the core interfaces:
| Interface | Description | Key Methods |
|---|---|---|
IDXGIFactory |
The factory interface used to enumerate DXGI objects. | EnumAdapters, EnumOutputs, CreateSwapChain |
IDXGIAdapter |
Represents a graphics adapter. | GetDesc, EnumOutputs, OpenSharedResource |
IDXGIOutput |
Represents a display output. | GetDesc, GetDisplayModeList, TakeNoOverlapScreenshot |
IDXGISwapChain |
Manages the buffers for presenting rendered frames. | Present, GetBuffer, ResizeBuffers |
IDXGISurface |
Represents a graphics surface. | Map, Unmap, GetDesc |
For a comprehensive list, please refer to the official DXGI documentation on Microsoft Docs.
Tutorials & Guides
Learn how to use DXGI effectively with these guides:
Code Samples
Explore practical examples of DXGI in action:
- Basic Swap Chain Example (C++)
- Advanced Resource Sharing Sample (C++)
- Adapter Enumeration Utility (C++)
You can find more samples on the Microsoft DirectX GitHub repository.