DirectX Graphics Infrastructure (DXGI)
The DirectX Graphics Infrastructure (DXGI) is a fundamental component of DirectX that enables graphics hardware to communicate with applications. It provides a set of interfaces and functions that manage adapters, output devices, and swap chains, facilitating the rendering and presentation of graphics.
Introduction
DXGI is responsible for abstracting the underlying graphics hardware and providing a consistent API for applications to interact with it. This includes enumerating available graphics adapters, selecting appropriate display output targets, and managing the presentation of rendered frames to the screen.
Key Concepts
- DXGI Adapter: Represents a graphics adapter (GPU) installed on the system.
- DXGI Output: Represents a display output connected to an adapter.
- DXGI Swap Chain: A mechanism used by applications to present rendered images to the display. It consists of a series of back buffers that can be flipped to the front buffer for display.
- DXGI Factory: Used to create DXGI objects and enumerate adapters and outputs.
Core Interfaces
DXGI defines several key interfaces that applications use to interact with the graphics subsystem:
IDXGIFactory
The root interface for DXGI. It's used to create DXGI objects and enumerate adapters.
interface IDXGIFactory : IUnknown { ... }
Methods:
EnumAdapters: Enumerates the graphics adapters.MakeWindowAssociation: Associates a window with DXGI for presentation.CreateSwapChain: Creates a swap chain.
IDXGIAdapter
Represents a graphics adapter.
interface IDXGIAdapter : IDXGIObject { ... }
Methods:
EnumOutputs: Enumerates the outputs connected to this adapter.GetDesc: Retrieves a description of the adapter.
IDXGIOutput
Represents a display output.
interface IDXGIOutput : IDXGIObject { ... }
Methods:
GetDesc: Retrieves a description of the output.GetDisplayModeList: Retrieves a list of supported display modes.
IDXGISwapChain
Represents a swap chain for presenting rendered frames.
interface IDXGISwapChain : IDXGIObject { ... }
Methods:
Present: Presents the next buffer in the swap chain.GetBuffer: Retrieves a back buffer.ResizeBuffers: Resizes the swap chain buffers.