This commit is contained in:
Julien Valentin 2019-12-27 02:46:35 +01:00
parent e605d6aa3d
commit 3526292de3
2 changed files with 9 additions and 9 deletions

View File

@ -267,7 +267,7 @@ class OSG_EXPORT GLBufferObject : public GraphicsObject
public: public:
GLExtensions* _extensions; GLExtensions* _extensions;
GLvoid* _persistantDMA; GLvoid* _persistentDMA;
}; };

View File

@ -63,7 +63,7 @@ GLBufferObject::GLBufferObject(unsigned int contextID, BufferObject* bufferObjec
_next(0), _next(0),
_frameLastUsed(0), _frameLastUsed(0),
_extensions(0), _extensions(0),
_persistantDMA(0) _persistentDMA(0)
{ {
assign(bufferObject); assign(bufferObject);
@ -221,12 +221,12 @@ void GLBufferObject::compileBuffer()
if(_profile._usage & GL_MAP_PERSISTENT_BIT) if(_profile._usage & GL_MAP_PERSISTENT_BIT)
{ {
// invalidate mapping of previously allocated // invalidate mapping of previously allocated
if(_persistantDMA) if(_persistentDMA)
{ {
_extensions->glUnmapBuffer(_profile._target); _extensions->glUnmapBuffer(_profile._target);
_persistantDMA = 0; _persistentDMA = 0;
} }
_persistantDMA = _extensions->glMapBufferRange( _profile._target, 0, _profile._size, _profile._usage); _persistentDMA = _extensions->glMapBufferRange( _profile._target, 0, _profile._size, _profile._usage);
} }
} }
else else
@ -263,10 +263,10 @@ void GLBufferObject::compileBuffer()
{ {
if(_profile._usage & GL_MAP_PERSISTENT_BIT) if(_profile._usage & GL_MAP_PERSISTENT_BIT)
{ {
if(_persistantDMA) if(_persistentDMA)
{ {
GLvoid* src = const_cast<GLvoid*>(entry.dataSource->getDataPointer()); GLvoid* src = const_cast<GLvoid*>(entry.dataSource->getDataPointer());
memcpy((unsigned char*)_persistantDMA + entry.offset, src, entry.dataSize); memcpy((unsigned char*)_persistentDMA + entry.offset, src, entry.dataSize);
_extensions->glFlushMappedBufferRange(_profile._target, (GLintptr)entry.offset, (GLsizeiptr)entry.dataSize); _extensions->glFlushMappedBufferRange(_profile._target, (GLintptr)entry.offset, (GLsizeiptr)entry.dataSize);
} }
else OSG_WARN<<" GL_MAP_PERSISTENT_BIT problem"<<std::endl; else OSG_WARN<<" GL_MAP_PERSISTENT_BIT problem"<<std::endl;
@ -312,11 +312,11 @@ void GLBufferObject::deleteGLObject()
OSG_DEBUG<<"GLBufferObject::deleteGLObject() "<<_glObjectID<<std::endl; OSG_DEBUG<<"GLBufferObject::deleteGLObject() "<<_glObjectID<<std::endl;
if (_glObjectID!=0) if (_glObjectID!=0)
{ {
if(_persistantDMA) if(_persistentDMA)
{ {
_extensions->glBindBuffer(_profile._target, _glObjectID); _extensions->glBindBuffer(_profile._target, _glObjectID);
_extensions->glUnmapBuffer(_profile._target); _extensions->glUnmapBuffer(_profile._target);
_persistantDMA = 0; _persistentDMA = 0;
_extensions->glBindBuffer(_profile._target, 0); _extensions->glBindBuffer(_profile._target, 0);
} }