feat: implement command queue with multi-frame buffering

D3D12 Core:
- Add d3d12_command class for command queue management
- Support Direct/Compute/Copy command queue types
- Implement multi-frame buffering (frame_buffer_count=3)
- Add begin_frame/end_frame rendering cycle
- Add NAME_D3D12_OBJECT_INDEXED macro

Platform Interface:
- Add render function pointer to platform_interface
- Implement render() in Renderer

Documentation:
- Add changelog for command queue implementation
- Update D3D12 Wiki with multi-frame buffering section
- Mark command queue task as completed
This commit is contained in:
SpecialX
2026-03-27 12:30:38 +08:00
parent 3fdc774f3f
commit 7da17ccadd
11 changed files with 406 additions and 23 deletions

View File

@@ -20,6 +20,9 @@
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3d12.lib")
namespace XEngine::graphics::d3d12::core {
constexpr u32 frame_buffer_count{ 3 };
}
// 定义 DirectX 调试宏 DXCall用于在调试模式下检查 DirectX API 调用返回值
// 如果调用失败FAILED则输出错误信息文件名、行号、调用语句并触发断点
@@ -46,9 +49,24 @@ if(FAILED(x)){ \
#endif // !DXCall
#endif // _DEBUG
// 定义 DirectX 对象命名宏,用于在调试模式下为 Direct3D 12 对象设置名称
// 定义 DirectX 对象命名宏,用于在调试模式下为 Direct3D 12 对象设置调试名称
// 这些宏仅在 _DEBUG 模式下生效,可帮助开发者在 PIX、RenderDoc 等图形调试工具中
// 识别和追踪 D3D12 对象(如缓冲区、纹理、管线状态等)
// NAME_D3D12_OBJECT: 为单个对象设置名称
// NAME_D3D12_OBJECT_INDEXED: 为数组中的对象设置带索引的名称(如资源数组)
#ifdef _DEBUG
#define NAME_D3D12_OBJECT(obj, name) obj->SetName(name); OutputDebugString(L"::D3D12 Object Created: ");OutputDebugString(name);OutputDebugString(L"\n");
#define NAME_D3D12_OBJECT(obj,name) obj->SetName(name); OutputDebugString(L"::D3D12 Object Created: "); OutputDebugString(name); OutputDebugString(L"\n");
#define NAME_D3D12_OBJECT_INDEXED(obj,n,name) \
{ \
wchar_t full_name[128]; \
if(swprintf_s(full_name, L"%s[%llu]", name, (u64)n) >0 ){ \
obj->SetName(full_name); \
OutputDebugString(L"::D3D12 Object Created: "); \
OutputDebugString(full_name); \
OutputDebugString(L"\n"); \
}}
#else
#define NAME_D3D12_OBJECT(obj, name)
#define NAME_D3D12_OBJECT(obj,name)
#define NAME_D3D12_OBJECT_INDEXED(obj,n,name)
#endif