Fix GLCircularVolatileBuffer incorrect binding.

This commit is contained in:
LuisAntonRebollo 2014-12-05 22:56:22 +01:00
parent 7097ce6466
commit d49018df63
2 changed files with 16 additions and 9 deletions

View file

@ -143,7 +143,7 @@ public:
{
glGenBuffers(1, &mBufferName);
PRESERVE_VERTEX_BUFFER();
PRESERVE_BUFFER( mBinding );
glBindBuffer(mBinding, mBufferName);
const U32 cSizeInMB = 10;
@ -195,11 +195,11 @@ public:
}
else if( GFXGL->glUseMap() )
{
PRESERVE_VERTEX_BUFFER();
glBindBuffer(GL_ARRAY_BUFFER, mBufferName);
PRESERVE_BUFFER( mBinding );
glBindBuffer(mBinding, mBufferName);
const GLbitfield access = GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT;
outPtr = glMapBufferRange(GL_ARRAY_BUFFER, outOffset, size, access);
outPtr = glMapBufferRange(mBinding, outOffset, size, access);
}
else
{
@ -224,15 +224,15 @@ public:
}
else if( GFXGL->glUseMap() )
{
PRESERVE_VERTEX_BUFFER();
glBindBuffer(GL_ARRAY_BUFFER, mBufferName);
PRESERVE_BUFFER( mBinding );
glBindBuffer(mBinding, mBufferName);
glUnmapBuffer(GL_ARRAY_BUFFER);
glUnmapBuffer(mBinding);
}
else
{
PRESERVE_VERTEX_BUFFER();
glBindBuffer(GL_ARRAY_BUFFER, mBufferName);
PRESERVE_BUFFER( mBinding );
glBindBuffer(mBinding, mBufferName);
glBufferSubData( mBinding, _getBufferData.mOffset, _getBufferData.mSize, mFrameAllocator.getlockedPtr() );

View file

@ -182,6 +182,13 @@ GFXGLPreserveInteger TORQUE_CONCAT(preserve_, __LINE__) (GL_ARRAY_BUFFER, GL_ARR
#define PRESERVE_INDEX_BUFFER() \
GFXGLPreserveInteger TORQUE_CONCAT(preserve_, __LINE__) (GL_ELEMENT_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER_BINDING, (GFXGLPreserveInteger::BindFn)glBindBuffer)
#define _GET_BUFFER_BINDING( BINDING ) \
BINDING == GL_ARRAY_BUFFER ? GL_ARRAY_BUFFER_BINDING : ( BINDING == GL_ELEMENT_ARRAY_BUFFER ? GL_ELEMENT_ARRAY_BUFFER_BINDING : 0 )
/// Helper macro to preserve the current element array binding.
#define PRESERVE_BUFFER( BINDING ) \
GFXGLPreserveInteger TORQUE_CONCAT(preserve_, __LINE__) (BINDING, _GET_BUFFER_BINDING(BINDING), (GFXGLPreserveInteger::BindFn)glBindBuffer)
/// ASSERT: Never call glActiveTexture for a "bind to modify" or in a PRESERVER_TEXTURE MACRO scope.
/// Helper macro to preserve the current 1D texture binding.