Renderer: Fix UploadPool allocations references

This commit is contained in:
Jérôme Leclercq
2021-05-14 01:56:32 +02:00
parent aeac3282e4
commit bbfe06c443
6 changed files with 48 additions and 9 deletions

View File

@@ -40,6 +40,10 @@ namespace Nz
VulkanUploadPool& operator=(VulkanUploadPool&&) = delete;
private:
static constexpr std::size_t AllocationPerBlock = 2048;
using AllocationBlock = std::array<VulkanAllocation, AllocationPerBlock>;
struct Block
{
Vk::DeviceMemory blockMemory;
@@ -49,8 +53,9 @@ namespace Nz
UInt64 m_blockSize;
Vk::Device& m_device;
std::size_t m_nextAllocationIndex;
std::vector<std::unique_ptr<AllocationBlock>> m_allocationBlocks;
std::vector<Block> m_blocks;
std::vector<VulkanAllocation> m_allocations;
};
}

View File

@@ -9,7 +9,8 @@ namespace Nz
{
inline VulkanUploadPool::VulkanUploadPool(Vk::Device& device, UInt64 blockSize) :
m_blockSize(blockSize),
m_device(device)
m_device(device),
m_nextAllocationIndex(0)
{
}
}