feat: implement D3D12 device initialization with debug layer

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
This commit is contained in:
SpecialX
2026-03-26 19:01:08 +08:00
parent b7eebc11b2
commit 3fdc774f3f
11 changed files with 425 additions and 15 deletions

View File

@@ -78,19 +78,36 @@ IDXGISwapChain // 交换链接口
### 3.2 项目当前状态
[D3D12Core.cpp](file:///d:/AllWX/AllC/FeatureExtractDemo/Engine/Graphics/Direct3D12/D3D12Core.cpp) 目前是框架代码
[D3D12Core.cpp](file:///d:/AllWX/AllC/FeatureExtractDemo/Engine/Graphics/Direct3D12/D3D12Core.cpp) 已实现完整的设备初始化
```cpp
namespace {
ID3D12Device8* main_device; // 已声明主设备
ID3D12Device8* main_device{ nullptr };
IDXGIFactory7* dxgi_factory{ nullptr };
}
bool initialize() {
// TODO: 实现适配器选择和设备创建
return true;
// 1. 启用调试层 (DEBUG 模式)
// 2. 创建 DXGI 工厂
// 3. 枚举并选择 GPU 适配器
// 4. 获取最高特性级别
// 5. 创建 D3D12 设备
// 6. 配置信息队列 (DEBUG 模式)
}
```
### 3.3 调试宏
项目定义了两个重要的调试宏:
```cpp
// DXCall - 检查 HRESULT 并断点
#define DXCall(x) if(FAILED(x)) { ... __debugbreak(); }
// NAME_D3D12_OBJECT - 为对象设置调试名称
#define NAME_D3D12_OBJECT(obj, name) obj->SetName(name);
```
## 4. COM 对象管理
### 4.1 什么是 COM
@@ -193,7 +210,7 @@ if (wparam == VK_RETURN && (HIWORD(lparam) & KF_ALTDOWN)) {
### 7.1 基础阶段
- [ ] 完成设备创建和适配器枚举
- [x] 完成设备创建和适配器枚举
- [ ] 创建命令队列和命令列表
- [ ] 实现交换链和后台缓冲区
- [ ] 渲染第一个三角形