Skip to content

Commit

Permalink
Fix error PBO code
Browse files Browse the repository at this point in the history
  • Loading branch information
loganmc10 committed Feb 5, 2017
1 parent d5052c0 commit dddb3ae
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ class PersistentWriteBuffer : public graphics::PixelWriteBuffer
{
glGenBuffers(1, &m_PBO);
m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle(m_PBO));
glBufferStorage(GL_PIXEL_UNPACK_BUFFER, m_size * 6, nullptr, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
m_bufferData = glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_size * 6, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
glBufferStorage(GL_PIXEL_UNPACK_BUFFER, m_size * 32, nullptr, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
m_bufferData = glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_size * 32, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
m_bufferOffset = 0;
m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle());
}
Expand All @@ -194,7 +194,7 @@ class PersistentWriteBuffer : public graphics::PixelWriteBuffer
{
if (_size > m_size)
_size = m_size;
if (m_bufferOffset + _size > m_size * 6)
if (m_bufferOffset + _size > m_size * 32)
m_bufferOffset = 0;
return (char*)m_bufferData + m_bufferOffset;
}
Expand All @@ -205,7 +205,7 @@ class PersistentWriteBuffer : public graphics::PixelWriteBuffer
}

void * getData() override {
return nullptr;
return (char*)nullptr + m_bufferOffset - m_size;
}

void bind() override {
Expand Down

0 comments on commit dddb3ae

Please sign in to comment.