feat: 实现D3D12Fence封装

- 添加D3D12Fence类封装ID3D12Fence
- 包含Signal/Wait/GetCompletedValue等同步功能
- 更新测试项目使用新的封装类
This commit is contained in:
2026-03-15 03:23:39 +08:00
parent 8fb11dc650
commit 17c8ea46c5
4 changed files with 94 additions and 8 deletions

View File

@@ -0,0 +1,34 @@
#pragma once
#include <d3d12.h>
#include <wrl/client.h>
#include <cstdint>
using Microsoft::WRL::ComPtr;
namespace XCEngine {
namespace RHI {
class D3D12Fence {
public:
D3D12Fence();
~D3D12Fence();
bool Initialize(ID3D12Device* device, uint64_t initialValue = 0);
void Shutdown();
void Signal(uint64_t value);
void Wait(uint64_t value);
uint64_t GetCompletedValue();
void* GetEventHandle() { return m_eventHandle; }
ID3D12Fence* GetFence() const { return m_fence.Get(); }
private:
ComPtr<ID3D12Fence> m_fence;
void* m_eventHandle;
};
} // namespace RHI
} // namespace XCEngine