feat: add Graphics module with D3D12 backend and documentation

Graphics Module:
- Add platform abstraction layer (GraphicsPlatformInterface)
- Add unified renderer entry point (Renderer)
- Add D3D12 backend implementation (D3D12Core, D3D12Interface)
- Add TestRenderer for multi-window rendering tests

Documentation:
- Add Graphics渲染架构分析.md
- Add D3D12学习Wiki.md
- Add changelogs directory with per-commit documentation
- Add 20260326-dx12-initial.md for initial framework
- Add 20260326-d3d12-foundation.md for Graphics module

Fixes:
- Resolve header include issues and type redefinition errors
This commit is contained in:
SpecialX
2026-03-26 16:53:09 +08:00
parent 6ca6970e34
commit b7eebc11b2
18 changed files with 937 additions and 2 deletions

View File

@@ -0,0 +1,101 @@
# 变更记录D3D12 基础框架
**提交日期**: 2026-03-26
**提交哈希**: `16723ba`
**变更类型**: 新增功能
---
## 变更概述
本次提交新增了 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. 平台抽象接口
```cpp
struct platform_interface {
bool(*initialize)(void);
void(*shutdown)(void);
};
```
通过函数指针实现运行时平台选择,支持 D3D12/Vulkan/OpenGL 多后端。
### 2. 渲染器入口
```cpp
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 智能指针
---
## 后续工作
- [ ] 适配器枚举与设备创建
- [ ] 命令队列实现
- [ ] 交换链管理
- [ ] 描述符堆
---
## 相关文档
- [Graphics渲染架构分析](../架构分析/Graphics渲染架构分析.md)
- [D3D12学习Wiki](../wiki/D3D12学习Wiki.md)