Overview
Constructor calls loadPipeline() to create DXGI factory, adapter, ID3D12Device4, and CommandQueue. init() builds SwapChain and GraphicsMemory (DirectXTK allocator). Owns the primary ID3D12GraphicsCommandList4 recycled through the queue.
Synchronization: double-buffered frames (FRAMES_IN_FLIGHT = 2 in Globals.h), per-slot fence values, waitForFenceValue before reusing command allocators. executeCurrentCommandList() submits work and returns new fence value.
How it works
- Device/queue created at construction.
- Each frame
preRenderwaits for current back-buffer slot fence. - Render modules record into shared command list.
postRenderexecutes, presents, commits transient allocations.
Internal architecture
ModuleD3D12
├── DXGI adapter/factory
├── ID3D12Device4
├── CommandQueue + command list
├── SwapChain → RenderSurface (COMPOSITE + DEPTH)
├── GraphicsMemory
└── Fence / frame index tracking
├── preRender — wait, reset list
└── postRender — execute, Present, Commit
Relationships
- Feeds device to
ModuleDescriptors,ModuleResources, and all render passes. ModuleRenderexecutes mid-frame command lists.- Window resize triggers
SwapChain::resize.
Technical features
- DirectX 12 device, command queue, and shared graphics command list.
- Swap chain with composite + depth surfaces; DirectXTK
GraphicsMemory. - Fence-based frame-in-flight synchronization (
FRAMES_IN_FLIGHT = 2).
Implementation notes
- Verified: device, swap chain, fence model, list execution helpers.