diff --git a/engine/include/XCEngine/RHI/D3D12/D3D12DescriptorHeap.h b/engine/include/XCEngine/RHI/D3D12/D3D12DescriptorHeap.h index b0e467f9..519cf422 100644 --- a/engine/include/XCEngine/RHI/D3D12/D3D12DescriptorHeap.h +++ b/engine/include/XCEngine/RHI/D3D12/D3D12DescriptorHeap.h @@ -4,6 +4,8 @@ #include #include "../Enums.h" +#include "../Types.h" +#include "../DescriptorHeap.h" #include "D3D12Enum.h" using Microsoft::WRL::ComPtr; @@ -11,7 +13,7 @@ using Microsoft::WRL::ComPtr; namespace XCEngine { namespace RHI { -class D3D12DescriptorHeap { +class D3D12DescriptorHeap : public IDescriptorHeap { public: D3D12DescriptorHeap(); ~D3D12DescriptorHeap(); @@ -21,11 +23,14 @@ public: ID3D12DescriptorHeap* GetDescriptorHeap() const { return m_descriptorHeap.Get(); } + CPUDescriptorHandle GetCPUDescriptorHandle(uint32_t index) override; + GPUDescriptorHandle GetGPUDescriptorHandle(uint32_t index) override; + uint32_t GetDescriptorCount() const override; + DescriptorType GetType() const override; + D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandle(uint32_t index) const; D3D12_GPU_DESCRIPTOR_HANDLE GetGPUDescriptorHandle(uint32_t index) const; - uint32_t GetDescriptorCount() const { return m_numDescriptors; } - DescriptorHeapType GetType() const { return m_type; } uint32_t GetDescriptorSize() const { return m_descriptorSize; } D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandleForHeapStart() const; diff --git a/engine/src/RHI/D3D12/D3D12DescriptorHeap.cpp b/engine/src/RHI/D3D12/D3D12DescriptorHeap.cpp index de4d1e57..2aa9efa4 100644 --- a/engine/src/RHI/D3D12/D3D12DescriptorHeap.cpp +++ b/engine/src/RHI/D3D12/D3D12DescriptorHeap.cpp @@ -58,5 +58,25 @@ D3D12_GPU_DESCRIPTOR_HANDLE D3D12DescriptorHeap::GetGPUDescriptorHandleForHeapSt return m_descriptorHeap->GetGPUDescriptorHandleForHeapStart(); } +CPUDescriptorHandle D3D12DescriptorHeap::GetCPUDescriptorHandle(uint32_t index) { + CPUDescriptorHandle handle; + handle.ptr = GetCPUDescriptorHandle(index).ptr; + return handle; +} + +GPUDescriptorHandle D3D12DescriptorHeap::GetGPUDescriptorHandle(uint32_t index) { + GPUDescriptorHandle handle; + handle.ptr = GetGPUDescriptorHandle(index).ptr; + return handle; +} + +DescriptorType D3D12DescriptorHeap::GetType() const { + return static_cast(m_type); +} + +uint32_t D3D12DescriptorHeap::GetDescriptorCount() const { + return m_numDescriptors; +} + } // namespace RHI } // namespace XCEngine