issues
search
GiiGaTeam
/
GiiGaEngine
0
stars
0
forks
source link
Descriptor Heap
#95
Open
damibran
opened
1 week ago
damibran
commented
1 week ago
UML
@startuml skinparam nodesep 200 'skinparam ranksep 200 class IDescriptorAllocator { virtual ~IDescriptorAllocator() = default; virtual DescriptorHeapAllocation Allocate(uint32_t Count) = 0; virtual void Free(DescriptorHeapAllocation&& , CmdQueueMask) = 0; virtual uint32_t GetDescriptorSize() const = 0; } class DescriptorHeapAllocation { + DescriptorHeapAllocation() + DescriptorHeapAllocation(IDescriptorAllocator& ,pHeap,CpuHandle, GpuHandle,NHandles,AllocationManagerId) + DescriptorHeapAllocation(DescriptorHeapAllocation&& Allocation) + DescriptorHeapAllocation& operator=(DescriptorHeapAllocation&& Allocation) + void Reset() + D3D12_CPU_DESCRIPTOR_HANDLE GetCpuHandle(uint32_t Offset = 0) + D3D12_GPU_DESCRIPTOR_HANDLE GetGpuHandle(uint32_t Offset = 0) + ID3D12DescriptorHeap GetDescriptorHeap() + size_t GetNumHandles() + bool IsNull() + bool IsShaderVisible() + size_t GetAllocationManagerId() + UINT GetDescriptorSize() } class DescriptorHeapAllocationManager { - shared_ptr
m_pd3d12DescriptorHeap; + DescriptorHeapAllocationManager(RenderDevice ,ParentAllocator,size_t ThisManagerId, HeapDesc) + DescriptorHeapAllocationManager(RenderDevice&, ParentAllocator,ThisManagerId, pd3d12DescriptorHeap, FirstDescriptor, NumDescriptors) + DescriptorHeapAllocationManager(DescriptorHeapAllocationManager&& rhs) + DescriptorHeapAllocation Allocate(uint32_t Count) + void FreeAllocation(DescriptorHeapAllocation&& Allocation) + size_t GetNumAvailableDescriptors() const { return m_FreeBlockManager.GetFreeSize(); } + uint32_t GetMaxDescriptors() const { return m_NumDescriptorsInAllocation; } + size_t GetMaxAllocatedSize() const { return m_MaxAllocatedSize; } } class CPUDescriptorHeap { - vector
m_HeapPool; + CPUDescriptorHeap(RenderDevice& ,NumDescriptorsInHeap,Type,Flags) + DescriptorHeapAllocation Allocate(uint32_t Count) + void Free(DescriptorHeapAllocation&& Allocation, uint64_t CmdQueueMask) + uint32_t GetDescriptorSize() } class GPUDescriptorHeap { - shared_ptr
m_pd3d12DescriptorHeap; - DescriptorHeapAllocationManager m_HeapAllocationManager; - DescriptorHeapAllocationManager m_DynamicAllocationsManager; + GPUDescriptorHeap(RenderDevice& ,NumDescriptorsInHeap,NumDynamicDescriptors,Type,Flags) + DescriptorHeapAllocation Allocate(uint32_t Count) + void Free(DescriptorHeapAllocation&& Allocation, uint64_t CmdQueueMask) + uint32_t GetDescriptorSize() + DescriptorHeapAllocation AllocateDynamic(uint32_t Count) + const D3D12_DESCRIPTOR_HEAP_DESC& GetHeapDesc() + uint32_t GetMaxStaticDescriptors() + uint32_t GetMaxDynamicDescriptors() } class DynamicSuballocationsManager { - GPUDescriptorHeap& m_ParentGPUHeap + DynamicSuballocationsManager(ParentGPUHeap,DynamicChunkSize,ManagerName) + void ReleaseAllocations(uint64_t CmdQueueMask) + DescriptorHeapAllocation Allocate(uint32_t Count) + void Free(DescriptorHeapAllocation&& Allocation, uint64_t CmdQueueMask) + uint32_t GetDescriptorSize() + size_t GetSuballocationCount() } IDescriptorAllocator <|-- CPUDescriptorHeap IDescriptorAllocator <|-- GPUDescriptorHeap IDescriptorAllocator <|-- DynamicSuballocationsManager DynamicSuballocationsManager::m_ParentGPUHeap .. GPUDescriptorHeap DescriptorHeapAllocationManager::Allocate .. DescriptorHeapAllocation : return CPUDescriptorHeap::Allocate .. DescriptorHeapAllocation : return DynamicSuballocationsManager::Allocate .. DescriptorHeapAllocation : return GPUDescriptorHeap::Allocate .. DescriptorHeapAllocation : return CPUDescriptorHeap::m_HeapPool "1" --* "1..*" DescriptorHeapAllocationManager GPUDescriptorHeap::m_HeapAllocationManager .. DescriptorHeapAllocationManager : heap = parent.heap GPUDescriptorHeap::m_DynamicAllocationsManager .. DescriptorHeapAllocationManager : heap = parent.heap class RenderDevice { m_CPUDescriptorHeaps[CBV_SRV_UAV] m_CPUDescriptorHeaps[SAMPLER] m_CPUDescriptorHeaps[RTV] m_CPUDescriptorHeaps[DSV] m_GPUDescriptorHeaps[CBV_SRV_UAV] m_GPUDescriptorHeaps[SAMPLER] } class FrameContext { m_DynamicGPUDescriptorAllocator[CBV_SRV_UAV] } RenderDevice .. CPUDescriptorHeap RenderDevice .. GPUDescriptorHeap FrameContext .. DynamicSuballocationsManager @enduml
UML
@startuml skinparam nodesep 200 'skinparam ranksep 200 class IDescriptorAllocator { virtual ~IDescriptorAllocator() = default; virtual DescriptorHeapAllocation Allocate(uint32_t Count) = 0; virtual void Free(DescriptorHeapAllocation&& , CmdQueueMask) = 0; virtual uint32_t GetDescriptorSize() const = 0; } class DescriptorHeapAllocation { + DescriptorHeapAllocation() + DescriptorHeapAllocation(IDescriptorAllocator& ,pHeap,CpuHandle, GpuHandle,NHandles,AllocationManagerId) + DescriptorHeapAllocation(DescriptorHeapAllocation&& Allocation) + DescriptorHeapAllocation& operator=(DescriptorHeapAllocation&& Allocation) + void Reset() + D3D12_CPU_DESCRIPTOR_HANDLE GetCpuHandle(uint32_t Offset = 0) + D3D12_GPU_DESCRIPTOR_HANDLE GetGpuHandle(uint32_t Offset = 0) + ID3D12DescriptorHeap GetDescriptorHeap() + size_t GetNumHandles() + bool IsNull() + bool IsShaderVisible() + size_t GetAllocationManagerId() + UINT GetDescriptorSize() } class DescriptorHeapAllocationManager { - shared_ptr