summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-10-06 23:03:25 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-10-06 23:03:25 +0000
commit41c249a537f8f793ec7193c0d70c5e58599d63d7 (patch)
treeb7711fa09412ad2fbdb9914132eba02646b11965 /Graphics/GraphicsEngineD3D12
parentSome mostly cosmetic code changes + better reporting of dynamic descriptor al... (diff)
downloadDiligentCore-41c249a537f8f793ec7193c0d70c5e58599d63d7.tar.gz
DiligentCore-41c249a537f8f793ec7193c0d70c5e58599d63d7.zip
Added VariableSizeAllocationsManager::Allocation::IsValid() method for clearer implementation
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp b/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp
index c7bd6272..d17e88a0 100644
--- a/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp
@@ -98,22 +98,19 @@ DescriptorHeapAllocation DescriptorHeapAllocationManager::Allocate(uint32_t Coun
// Use variable-size GPU allocations manager to allocate the requested number of descriptors
auto Allocation = m_FreeBlockManager.Allocate(Count, 1);
- auto DescriptorHandleOffset = Allocation.UnalignedOffset;
- if (DescriptorHandleOffset == VariableSizeAllocationsManager::InvalidOffset)
- {
+ if (!Allocation.IsValid())
return DescriptorHeapAllocation{};
- }
VERIFY_EXPR(Allocation.Size == Count);
// Compute the first CPU and GPU descriptor handles in the allocation by
// offseting the first CPU and GPU descriptor handle in the range
auto CPUHandle = m_FirstCPUHandle;
- CPUHandle.ptr += DescriptorHandleOffset * m_DescriptorSize;
+ CPUHandle.ptr += Allocation.UnalignedOffset * m_DescriptorSize;
auto GPUHandle = m_FirstGPUHandle; // Will be null if the heap is not GPU-visible
if (m_HeapDesc.Flags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE)
- GPUHandle.ptr += DescriptorHandleOffset * m_DescriptorSize;
+ GPUHandle.ptr += Allocation.UnalignedOffset * m_DescriptorSize;
m_MaxAllocatedSize = std::max(m_MaxAllocatedSize, m_FreeBlockManager.GetUsedSize());