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

@@ -11,7 +11,8 @@
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/OpenGLRenderer/Config.hpp>
#include <Nazara/Renderer/UploadPool.hpp>
#include <optional>
#include <array>
#include <memory>
#include <vector>
namespace Nz
@@ -33,14 +34,19 @@ namespace Nz
OpenGLUploadPool& operator=(OpenGLUploadPool&&) = delete;
private:
static constexpr std::size_t AllocationPerBlock = 2048;
using AllocationBlock = std::array<Allocation, AllocationPerBlock>;
struct Block
{
std::vector<UInt8> memory;
UInt64 freeOffset = 0;
};
std::size_t m_nextAllocationIndex;
std::vector<std::unique_ptr<AllocationBlock>> m_allocationBlocks;
std::vector<Block> m_blocks;
std::vector<Allocation> m_allocations;
UInt64 m_blockSize;
};
}

View File

@@ -8,7 +8,8 @@
namespace Nz
{
inline OpenGLUploadPool::OpenGLUploadPool(UInt64 blockSize) :
m_blockSize(blockSize)
m_blockSize(blockSize),
m_nextAllocationIndex(0)
{
}
}