feat: 实现D3D12Fence封装
- 添加D3D12Fence类封装ID3D12Fence - 包含Signal/Wait/GetCompletedValue等同步功能 - 更新测试项目使用新的封装类
This commit is contained in:
34
engine/include/XCEngine/RHI/D3D12/D3D12Fence.h
Normal file
34
engine/include/XCEngine/RHI/D3D12/D3D12Fence.h
Normal 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
|
||||
Reference in New Issue
Block a user