Building a Game Engine from Scratch (Day 8) | DirectX 12 Constant Buffers & Frames in Flight (C++20)

Day 8 of building TitanEngine from scratch using C++20 and native DirectX 12 — zero wrappers, zero helper libraries (no d3dx12.h).

Today we open the dynamic CPU-to-GPU communication pipeline by implementing Constant Buffers (CBV) synchronized with our Frames in Flight architecture. Instead of static geometry, the CPU now pushes real-time offset data every frame safely without data races.

:wrench: What we built on Day 8:
• Root Signature update: Adding a Root Parameter (CBV) bound to shader register b0.
• Strict 256-byte memory alignment enforced at compile-time via static_assert.
• Per-frame Constant Buffer allocation on UPLOAD heaps with persistent memory mapping (Map).
• Real-time buffer updates via memcpy synchronized by frameIndex.
• HLSL Vertex Shader integration reading cbuffer data from register(b0).

:hammer_and_wrench: Tech Stack:
• Language: C++20
• Graphics API: Native DirectX 12 / DXGI 1.6 / HLSL (Shader Model 5.0)
• Platform: Windows x64 (Win32 API)

Link video day 8:https://youtu.be/-pnQaOFhavA

Next up: Index Buffers for complex 3D meshes and high-resolution DeltaTime timing.

#DirectX12 CPP #GameEngine #GraphicsProgramming #LowLevelCode #EngineProgramming hlsl #GameDev #TitanEngine