1 template <
size_t subBufferPerChunk,
size_t subBufferSize>
3 : _renderer(renderer), _queueFamilyIndices(queueFamilyIndices)
6 template <
size_t subBufferPerChunk,
size_t subBufferSize>
8 auto it = _subBuffersInUse.find(hash);
9 if (it == _subBuffersInUse.end() || dirty) {
10 SubBuffer* subBuffer = allocateNewBuffer();
13 return std::make_tuple(
false,
nullptr);
17 _subBuffersInUse[hash] = subBuffer;
19 return std::make_tuple(
true, subBuffer);
22 it->second->_referenceCount += 1;
23 return std::make_tuple(
false, it->second);
26 template <
size_t subBufferPerChunk,
size_t subBufferSize>
32 const_cast<SubBuffer*
>(buffer)->_referenceCount -= 1;
34 const auto it = _subBuffersInUse.find(buffer->
getHash());
35 if (buffer->
_referenceCount == 0 && it != _subBuffersInUse.end() && it->second == buffer) {
36 _subBuffersInUse.erase(buffer->
getHash());
40 template <
size_t subBufferPerChunk,
size_t subBufferSize>
42 for (
auto& chunk : _chunks) {
43 SubBuffer* subBuffer = chunk.getFreeSubBuffer();
53 _chunks.emplace_back();
55 if (_chunks.back().init(_renderer, _queueFamilyIndices)) {
56 return allocateNewBuffer();
void setHash(size_t hash)