diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-10-06 23:03:25 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-10-06 23:03:25 +0000 |
| commit | 41c249a537f8f793ec7193c0d70c5e58599d63d7 (patch) | |
| tree | b7711fa09412ad2fbdb9914132eba02646b11965 /Graphics/GraphicsEngineD3D12 | |
| parent | Some mostly cosmetic code changes + better reporting of dynamic descriptor al... (diff) | |
| download | DiligentCore-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.cpp | 9 |
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()); |
