Separate viewport target and descriptor ownership
This commit is contained in:
55
new_editor/app/Host/D3D12ShaderResourceDescriptorAllocator.h
Normal file
55
new_editor/app/Host/D3D12ShaderResourceDescriptorAllocator.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <XCEngine/RHI/D3D12/D3D12DescriptorHeap.h>
|
||||
#include <XCEngine/RHI/D3D12/D3D12Device.h>
|
||||
#include <XCEngine/RHI/D3D12/D3D12Texture.h>
|
||||
#include <XCEngine/RHI/RHIDescriptorPool.h>
|
||||
#include <XCEngine/RHI/RHIDevice.h>
|
||||
#include <XCEngine/RHI/RHITexture.h>
|
||||
|
||||
#include <d3d12.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor::Host {
|
||||
|
||||
class D3D12ShaderResourceDescriptorAllocator {
|
||||
public:
|
||||
bool Initialize(::XCEngine::RHI::RHIDevice& device, UINT descriptorCount = 64u);
|
||||
void Shutdown();
|
||||
|
||||
bool IsInitialized() const;
|
||||
ID3D12DescriptorHeap* GetDescriptorHeap() const;
|
||||
UINT GetDescriptorSize() const;
|
||||
UINT GetDescriptorCount() const;
|
||||
|
||||
void Allocate(
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE* outCpuHandle,
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE* outGpuHandle);
|
||||
bool CreateTextureDescriptor(
|
||||
::XCEngine::RHI::RHITexture* texture,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE* outCpuHandle,
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE* outGpuHandle);
|
||||
void Free(
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle,
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle);
|
||||
|
||||
private:
|
||||
void AllocateInternal(
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE* outCpuHandle,
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE* outGpuHandle);
|
||||
|
||||
::XCEngine::RHI::RHIDevice* m_device = nullptr;
|
||||
::XCEngine::RHI::RHIDescriptorPool* m_descriptorPool = nullptr;
|
||||
::XCEngine::RHI::D3D12DescriptorHeap* m_descriptorHeap = nullptr;
|
||||
std::vector<bool> m_descriptorUsage = {};
|
||||
UINT m_descriptorSize = 0u;
|
||||
UINT m_descriptorCount = 0u;
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Host
|
||||
Reference in New Issue
Block a user