docs: 重构 API 文档结构并修正源码准确性
- 重组文档目录结构: 每个模块的概述页移动到模块子目录
- 重命名 index.md 为 main.md
- 修正所有模块文档中的错误:
- math: FromEuler→FromEulerAngles, TransformDirection 包含缩放, Box 是 OBB, Color::ToRGBA 格式
- containers: 新增 operator==/!= 文档, 补充 std::hash DJB 算法细节
- core: 修复 types 链接错误
- debug: LogLevelToString 返回大写, timestamp 是秒, Profiler 空实现标注, Windows API vs ANSI
- memory: 修复头文件路径, malloc vs operator new, 新增方法文档
- resources: 修复 Shader/Texture 链接错误
- threading: TaskSystem::Wait 空实现标注, ReadWriteLock 重入描述, LambdaTask 链接
- 验证: fix_links.py 确认 0 个断裂引用
2026-03-19 00:22:30 +08:00
|
|
|
# D3D12Device
|
|
|
|
|
|
|
|
|
|
**命名空间**: `XCEngine::RHI`
|
|
|
|
|
|
2026-03-20 02:35:45 +08:00
|
|
|
**继承自**: `RHIDevice`
|
|
|
|
|
|
|
|
|
|
**描述**: DirectX 12 设备实现,用于管理 D3D12 图形适配器、创建资源和管理命令队列。
|
docs: 重构 API 文档结构并修正源码准确性
- 重组文档目录结构: 每个模块的概述页移动到模块子目录
- 重命名 index.md 为 main.md
- 修正所有模块文档中的错误:
- math: FromEuler→FromEulerAngles, TransformDirection 包含缩放, Box 是 OBB, Color::ToRGBA 格式
- containers: 新增 operator==/!= 文档, 补充 std::hash DJB 算法细节
- core: 修复 types 链接错误
- debug: LogLevelToString 返回大写, timestamp 是秒, Profiler 空实现标注, Windows API vs ANSI
- memory: 修复头文件路径, malloc vs operator new, 新增方法文档
- resources: 修复 Shader/Texture 链接错误
- threading: TaskSystem::Wait 空实现标注, ReadWriteLock 重入描述, LambdaTask 链接
- 验证: fix_links.py 确认 0 个断裂引用
2026-03-19 00:22:30 +08:00
|
|
|
|
|
|
|
|
## 公共方法
|
|
|
|
|
|
2026-03-19 02:01:18 +08:00
|
|
|
| 方法 | 描述 |
|
docs: 重构 API 文档结构并修正源码准确性
- 重组文档目录结构: 每个模块的概述页移动到模块子目录
- 重命名 index.md 为 main.md
- 修正所有模块文档中的错误:
- math: FromEuler→FromEulerAngles, TransformDirection 包含缩放, Box 是 OBB, Color::ToRGBA 格式
- containers: 新增 operator==/!= 文档, 补充 std::hash DJB 算法细节
- core: 修复 types 链接错误
- debug: LogLevelToString 返回大写, timestamp 是秒, Profiler 空实现标注, Windows API vs ANSI
- memory: 修复头文件路径, malloc vs operator new, 新增方法文档
- resources: 修复 Shader/Texture 链接错误
- threading: TaskSystem::Wait 空实现标注, ReadWriteLock 重入描述, LambdaTask 链接
- 验证: fix_links.py 确认 0 个断裂引用
2026-03-19 00:22:30 +08:00
|
|
|
|------|------|
|
2026-03-20 02:35:45 +08:00
|
|
|
| [`Initialize`](initialize.md) | 初始化 D3D12 设备 |
|
|
|
|
|
| [`Shutdown`](shutdown.md) | 关闭设备 |
|
|
|
|
|
| [`CreateBuffer`](create-buffer.md) | 创建缓冲区 |
|
|
|
|
|
| [`CreateTexture`](create-texture.md) | 创建纹理 |
|
|
|
|
|
| [`CreateSwapChain`](create-swap-chain.md) | 创建交换链 |
|
|
|
|
|
| [`CreateCommandList`](create-command-list.md) | 创建命令列表 |
|
|
|
|
|
| [`CreateCommandQueue`](create-command-queue.md) | 创建命令队列 |
|
|
|
|
|
| [`CompileShader`](compile-shader.md) | 编译着色器 |
|
|
|
|
|
| [`CreatePipelineState`](create-pipeline-state.md) | 创建管线状态 |
|
|
|
|
|
| [`CreateFence`](create-fence.md) | 创建栅栏 |
|
|
|
|
|
| [`CreateSampler`](create-sampler.md) | 创建采样器 |
|
|
|
|
|
| [`GetCapabilities`](get-capabilities.md) | 获取设备能力 |
|
|
|
|
|
| [`GetDeviceInfo`](get-device-info.md) | 获取设备信息 |
|
|
|
|
|
| [`GetNativeDevice`](get-native-device.md) | 获取原生设备 |
|
|
|
|
|
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
|
2026-03-19 02:01:18 +08:00
|
|
|
| [`GetDevice`](get-device.md) | 获取 D3D12 设备 |
|
|
|
|
|
| [`GetFactory`](get-factory.md) | 获取 D3D12 工厂 |
|
|
|
|
|
| [`GetAdapterInfo`](get-adapter-info.md) | 获取适配器信息 |
|
|
|
|
|
| [`EnumerateAdapters`](enumerate-adapters.md) | 枚举适配器 |
|
|
|
|
|
| [`GetDescriptorHandleIncrementSize`](get-descriptor-handle-increment-size.md) | 获取描述符增量大小 |
|
|
|
|
|
| [`CheckFeatureSupport`](check-feature-support.md) | 检查特性支持 |
|
2026-03-20 02:35:45 +08:00
|
|
|
| [`SetDeviceRemoved`](set-device-removed.md) | 设置设备已移除 |
|
|
|
|
|
| [`IsDeviceRemoved`](is-device-removed.md) | 查询设备是否已移除 |
|
|
|
|
|
|
|
|
|
|
## 使用示例
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
RHIDeviceDesc desc;
|
|
|
|
|
desc.adapterIndex = 0;
|
|
|
|
|
desc.enableDebugLayer = true;
|
|
|
|
|
|
|
|
|
|
D3D12Device* device = new D3D12Device();
|
|
|
|
|
if (device->Initialize(desc)) {
|
|
|
|
|
ID3D12Device* nativeDevice = device->GetDevice();
|
|
|
|
|
// 使用设备...
|
|
|
|
|
device->Shutdown();
|
|
|
|
|
}
|
|
|
|
|
delete device;
|
|
|
|
|
```
|
docs: 重构 API 文档结构并修正源码准确性
- 重组文档目录结构: 每个模块的概述页移动到模块子目录
- 重命名 index.md 为 main.md
- 修正所有模块文档中的错误:
- math: FromEuler→FromEulerAngles, TransformDirection 包含缩放, Box 是 OBB, Color::ToRGBA 格式
- containers: 新增 operator==/!= 文档, 补充 std::hash DJB 算法细节
- core: 修复 types 链接错误
- debug: LogLevelToString 返回大写, timestamp 是秒, Profiler 空实现标注, Windows API vs ANSI
- memory: 修复头文件路径, malloc vs operator new, 新增方法文档
- resources: 修复 Shader/Texture 链接错误
- threading: TaskSystem::Wait 空实现标注, ReadWriteLock 重入描述, LambdaTask 链接
- 验证: fix_links.py 确认 0 个断裂引用
2026-03-19 00:22:30 +08:00
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
2026-03-20 02:35:45 +08:00
|
|
|
- [D3D12 后端总览](../d3d12.md)
|
docs: 重构 API 文档结构并修正源码准确性
- 重组文档目录结构: 每个模块的概述页移动到模块子目录
- 重命名 index.md 为 main.md
- 修正所有模块文档中的错误:
- math: FromEuler→FromEulerAngles, TransformDirection 包含缩放, Box 是 OBB, Color::ToRGBA 格式
- containers: 新增 operator==/!= 文档, 补充 std::hash DJB 算法细节
- core: 修复 types 链接错误
- debug: LogLevelToString 返回大写, timestamp 是秒, Profiler 空实现标注, Windows API vs ANSI
- memory: 修复头文件路径, malloc vs operator new, 新增方法文档
- resources: 修复 Shader/Texture 链接错误
- threading: TaskSystem::Wait 空实现标注, ReadWriteLock 重入描述, LambdaTask 链接
- 验证: fix_links.py 确认 0 个断裂引用
2026-03-19 00:22:30 +08:00
|
|
|
- [RHIDevice](../../device/device.md) - 抽象设备接口
|