D3D12 Core: - Implement complete device initialization flow - Add debug layer enablement in DEBUG mode - Add GPU adapter enumeration and selection - Add feature level checking (min 11.0) - Add DXCall and NAME_D3D12_OBJECT macros - Add release template function - Configure info queue for error/warning breakpoints Documentation: - Add changelog for D3D12 device initialization - Update D3D12 Wiki with current implementation status - Add Doxygen comments to Renderer and platform interface
2.2 KiB
2.2 KiB
变更记录:D3D12 基础框架
提交日期: 2026-03-26
提交哈希: b7eebc1
变更类型: 新增功能
变更概述
本次提交新增了 Graphics 渲染模块和 Direct3D12 后端框架,实现了平台抽象层设计,为后续图形渲染功能奠定基础。
新增文件
Engine/Graphics/Direct3D12/
| 文件 | 说明 |
|---|---|
D3D12CommonHeader.h |
D3D12 公共头文件,引入 DXGI、D3D12、WRL 依赖 |
D3D12Core.h |
D3D12 核心模块头文件 |
D3D12Core.cpp |
D3D12 核心初始化/关闭实现(框架代码) |
D3D12Interface.h |
平台接口绑定声明 |
D3D12Interface.cpp |
将 D3D12 实现绑定到平台接口 |
Engine/Graphics/
| 文件 | 说明 |
|---|---|
GraphicsPlatformInterface.h |
平台抽象接口定义 |
Renderer.h |
统一渲染器入口声明 |
Renderer.cpp |
渲染器初始化与平台选择逻辑 |
EngineTest/
| 文件 | 说明 |
|---|---|
TestRenderer.h |
渲染测试类声明 |
TestRenderer.cpp |
多窗口渲染测试实现 |
docs/
| 文件 | 说明 |
|---|---|
架构分析/Graphics渲染架构分析.md |
Graphics 模块架构分析文档 |
wiki/D3D12学习Wiki.md |
D3D12 学习知识汇总 |
技术要点
1. 平台抽象接口
struct platform_interface {
bool(*initialize)(void);
void(*shutdown)(void);
};
通过函数指针实现运行时平台选择,支持 D3D12/Vulkan/OpenGL 多后端。
2. 渲染器入口
enum class graphics_platform : u32 {
direct3d12 = 0,
vulkan = 1,
opengl = 2,
};
bool initialize(graphics_platform platform);
void shutdown();
3. 多窗口测试
TestRenderer 支持创建 4 个独立渲染窗口,并实现 Alt+Enter 全屏切换。
依赖引入
<dxgi_6.h>- DXGI 6.0 接口<d3d12.h>- Direct3D 12 API<wrl.h>- COM 智能指针
后续工作
- 适配器枚举与设备创建
- 命令队列实现
- 交换链管理
- 描述符堆