Buffer overflow fixes

This commit is contained in:
Jack Andersen 2016-12-11 10:21:25 -10:00
parent db542135df
commit e9dc6787ce
2 changed files with 5 additions and 3 deletions

View File

@ -66,7 +66,8 @@ class UniformBufferPool
void updateBuffer() void updateBuffer()
{ {
buffer->unmap(); if (buffer)
buffer->unmap();
cpuBuffer = nullptr; cpuBuffer = nullptr;
dirty = false; dirty = false;
} }

View File

@ -66,7 +66,8 @@ class VertexBufferPool
void updateBuffer() void updateBuffer()
{ {
buffer->unmap(); if (buffer)
buffer->unmap();
cpuBuffer = nullptr; cpuBuffer = nullptr;
dirty = false; dirty = false;
} }
@ -106,7 +107,7 @@ public:
assert(count <= pool.m_countPerBucket && "unable to fit in bucket"); assert(count <= pool.m_countPerBucket && "unable to fit in bucket");
auto& freeSpaces = pool.m_freeElements; auto& freeSpaces = pool.m_freeElements;
auto& buckets = pool.m_buckets; auto& buckets = pool.m_buckets;
int idx = freeSpaces.find_first_contiguous(count); int idx = freeSpaces.find_first_contiguous(count, pool.m_countPerBucket);
if (idx == -1) if (idx == -1)
{ {
buckets.emplace_back(); buckets.emplace_back();