feat(RHI): 添加 RHIDescriptorPool 抽象类

- 新增 RHIDescriptorPool 抽象基类,定义描述符池统一接口
- D3D12DescriptorHeap 现在继承自 RHIDescriptorPool
- 添加 DescriptorPoolDesc 结构体,包含设备指针、类型、数量等信息
- 添加 Initialize(const DescriptorPoolDesc&) 统一初始化方法
This commit is contained in:
2026-03-18 01:46:01 +08:00
parent a220638298
commit a532cabf92
4 changed files with 52 additions and 7 deletions

View File

@@ -14,6 +14,15 @@ D3D12DescriptorHeap::~D3D12DescriptorHeap() {
Shutdown();
}
bool D3D12DescriptorHeap::Initialize(const DescriptorPoolDesc& desc) {
return Initialize(
static_cast<ID3D12Device*>(desc.device),
desc.type,
desc.descriptorCount,
desc.shaderVisible
);
}
bool D3D12DescriptorHeap::Initialize(ID3D12Device* device, DescriptorHeapType type, uint32_t numDescriptors, bool shaderVisible) {
D3D12_DESCRIPTOR_HEAP_DESC desc = {};
desc.Type = ToD3D12(type);
@@ -62,8 +71,8 @@ GPUDescriptorHandle D3D12DescriptorHeap::GetGPUDescriptorHandle(uint32_t index)
return result;
}
DescriptorType D3D12DescriptorHeap::GetType() const {
return static_cast<DescriptorType>(m_type);
DescriptorHeapType D3D12DescriptorHeap::GetType() const {
return m_type;
}
uint32_t D3D12DescriptorHeap::GetDescriptorCount() const {