diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp index f2f287408..c43005b6e 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp @@ -240,7 +240,6 @@ CDriverGL3::CDriverGL3() _CurrentVertexBufferGL= NULL; /*_NVCurrentVARPtr= NULL; _NVCurrentVARSize= 0;*/ - _SlowUnlockVBHard= true; _AllocatedTextureMemory= 0; diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.h b/code/nel/src/3d/driver/opengl3/driver_opengl.h index e7fc173db..2d52e6446 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.h @@ -1131,7 +1131,6 @@ private: // The VertexBufferHardGL activated. IVertexBufferGL *_CurrentVertexBufferGL; - bool _SlowUnlockVBHard; GLenum vertexBufferUsageGL3(CVertexBuffer::TPreferredMemory usage); // Handle lost buffers diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_vertex.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl_vertex.cpp index a30e42682..8ef0e4c3a 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_vertex.cpp @@ -230,7 +230,7 @@ bool CDriverGL3::supportVolatileVertexBuffer() const bool CDriverGL3::slowUnlockVertexBufferHard() const { H_AUTO_OGL(CDriverGL3_slowUnlockVertexBufferHard) - return _SlowUnlockVBHard; + return false; } @@ -500,8 +500,6 @@ bool CDriverGL3::initVertexBufferHard(uint agpMem, uint vramMem) { H_AUTO_OGL(CDriverGL3_initVertexBufferHard) - _SlowUnlockVBHard = true; - return true; } diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_vertex_buffer.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl_vertex_buffer.cpp index 61130fb54..ef43e156b 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_vertex_buffer.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_vertex_buffer.cpp @@ -131,7 +131,6 @@ void *CVertexBufferGL::lock() } m_Driver->_DriverGLStates.bindARBVertexBuffer(VertexObjectId); - // m_VertexPtr = nglMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); // PERFORMANCE: AMD: This brings framerate from 24fps to 38fps, glitches with volatile buffers such as animated models and gui, likely glitches with others @@ -146,10 +145,13 @@ void *CVertexBufferGL::lock() { case CVertexBuffer::AGPVolatile: case CVertexBuffer::RAMVolatile: + // NOTE: GL_MAP_INVALIDATE_BUFFER_BIT removes the cost of waiting for synchronization (major performance impact), + // but adds the cost of allocating a new buffer (which hast a much lower performance impact) m_VertexPtr = nglMapBufferRange(GL_ARRAY_BUFFER, 0, size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); break; case CVertexBuffer::RAMPreferred: - // m_VertexPtr = nglMapBufferRange(GL_ARRAY_BUFFER, 0, size, GL_MAP_WRITE_BIT | GL_MAP_READ_BIT); + // m_VertexPtr = nglMapBufferRange(GL_ARRAY_BUFFER, 0, size, GL_MAP_WRITE_BIT | GL_MAP_READ_BIT | GL_MAP_PERSISTENT | GL_MAP_COHERENT); + // NOTE: Persistent / Coherent is only available in OpenGL 4.4 (2013/2014 hardware with recent drivers) m_VertexPtr = nglMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); break; default: