Files
XCEngine/engine/include/XCEngine/RHI/D3D12/D3D12DescriptorHeap.h

49 lines
1.4 KiB
C++

#pragma once
#include <d3d12.h>
#include <wrl/client.h>
#include "../Enums.h"
#include "../Types.h"
#include "../DescriptorHeap.h"
#include "D3D12Enum.h"
using Microsoft::WRL::ComPtr;
namespace XCEngine {
namespace RHI {
class D3D12DescriptorHeap : public IDescriptorHeap {
public:
D3D12DescriptorHeap();
~D3D12DescriptorHeap();
bool Initialize(ID3D12Device* device, DescriptorHeapType type, uint32_t numDescriptors, bool shaderVisible = false);
void Shutdown();
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 GetDescriptorSize() const { return m_descriptorSize; }
D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandleForHeapStart() const;
D3D12_GPU_DESCRIPTOR_HANDLE GetGPUDescriptorHandleForHeapStart() const;
private:
ComPtr<ID3D12DescriptorHeap> m_descriptorHeap;
DescriptorHeapType m_type;
uint32_t m_numDescriptors;
uint32_t m_descriptorSize;
bool m_shaderVisible;
};
} // namespace RHI
} // namespace XCEngine