D3D12 FlightDemo


Overview

This project is a lightweight 3D flight demo in C++ using the DirectX 12 graphics API. Developed as a learning exercise, it focuses on the CPU-side setup of the D3D12 rendering pipeline. The demo also implements design patterns for the game-specific systems such as a command queue for actions and scene stack management.

View Repository


CPU-side Stages of the D3D12 Rendering Pipeline

This focuses on the CPU-side setup and execution of the DirectX 12 rendering pipeline, covering five core stages from device initialization to rendering.

⚠️ Note: It does not detail GPU pipeline internals like shading or rasterization.

Initialization stages 1-5, are all executed once within Game::Initialize():

bool Game::Initialize()
{
    // 1. Device Initialization
    if (!D3DApp::Initialize()) 
	    return false;   
        
	// 2. Graphics Pipeline Configuration
	BuildRootSignature();
	BuildShadersAndInputLayout();
	BuildPSOs();
 
	// 3. Resource Asset Setup
	LoadTextures();
	BuildMaterials();
	BuildDescriptorHeaps();
 
	// 4. Geometry and Vertex Buffer Setup
	BuildShapeGeometry();
 
	// 5. Frame Resources Setup
	BuildFrameResources();
    
    /* Other code omitted for clarity */
    
    return true;
}


Stage 1 - Device Initialization

  • What is the D3D12 Device?

    • The D3D12 device is the core interface between your program and the GPU. It manages all GPU-related tasks in D3D12, including:
      • Creating GPU resources like buffers and textures
      • Managing descriptor heaps and command objects
      • Controlling rendering operations and querying hardware capabilities
  • Key Method

    • bool D3DApp::InitDirect3D():
      • Called once by D3DApp::Initialize(). It creates the graphics device and sets up communication with the GPU. It selects the best graphics adapter and initializes device resources like descriptor sizes (used to access GPU resources) and multisampling support (for anti-aliasing).

Stage 2 - Graphics Pipeline Configuration

  • What is it?

    • This stage defines how rendering is performed by configuring the GPU pipeline. It prepares the root signature, compiles shader code, and creates Pipeline State Objects.
  • Key Methods


Stage 3 - Resource Asset Setup

  • What is it?

    • This stage prepares the resources that will be used during rendering; it loads texture data, defines material properties, and sets up the descriptor heap that allows shaders to access those resources.
  • Key Methods


Stage 4 - Geometry and Vertex Buffer Setup

  • What is it?

    • This stage generates the meshes and shapes that will be rendered; it creates vertex and index buffers for the GPU.
  • Key Method


Stage 5 - Frame Resources Setup

  • What is it?

  • Key Method

    • void Game::BuildFrameResources():
      • Allocates a set of resources for each frame (e.g., constant buffers and command allocators) to let the CPU prepare upcoming frames while the GPU works on the current one.

Conclusion

This project applies core DirectX 12 concepts through a clear, step-by-step pipeline setup. Beyond rendering, it applies systems like command queue for actions and scene stack management, enabling the systematic development and implementation of scalable 3D applications in C++. It served as a strong entry point into low-level graphics programming and engine architecture design.