From 60851a863e060f7068f3378e72a4580016da9465 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 5 Jun 2014 13:02:41 +0200 Subject: [PATCH] GL3: Cleanup --HG-- branch : opengl3 --- .../driver/opengl3/driver_opengl_vertex.cpp | 6 ++--- .../opengl3/driver_opengl_vertex_buffer.cpp | 26 +++++++++---------- .../opengl3/driver_opengl_vertex_buffer.h | 8 +++--- 3 files changed, 19 insertions(+), 21 deletions(-) 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 1349c7f45..c32797a91 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_vertex.cpp @@ -286,11 +286,11 @@ void CDriverGL3::updateLostBuffers() { for (std::list::iterator it = _LostVBList.begin(); it != _LostVBList.end(); ++it) { - nlassert((*it)->VertexObjectId); - GLuint id = (GLuint) (*it)->VertexObjectId; + nlassert((*it)->m_VertexObjectId); + GLuint id = (GLuint) (*it)->m_VertexObjectId; nlassert(nglIsBuffer(id)); nglDeleteBuffers(1, &id); - (*it)->VertexObjectId = 0; + (*it)->m_VertexObjectId = 0; (*it)->VB->setLocation(CVertexBuffer::NotResident); } _LostVBList.clear(); 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 679bbdd27..cb6c7f43a 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 @@ -47,7 +47,7 @@ IVertexBufferGL3::~IVertexBufferGL3() CVertexBufferGL3::CVertexBufferGL3(CDriverGL3 *drv, CVertexBuffer *vb) : IVertexBufferGL3(drv, vb, IVertexBufferGL3::GL3), m_VertexPtr(NULL), - VertexObjectId(0) + m_VertexObjectId(0) { H_AUTO_OGL(CVertexBufferGLARB_CVertexBufferGLARB) } @@ -56,16 +56,16 @@ CVertexBufferGL3::CVertexBufferGL3(CDriverGL3 *drv, CVertexBuffer *vb) CVertexBufferGL3::~CVertexBufferGL3() { H_AUTO_OGL(CVertexBufferGLARB_CVertexBufferGLARBDtor) - if (m_Driver && VertexObjectId) + if (m_Driver && m_VertexObjectId) { - if (m_Driver->_DriverGLStates.getCurrBoundARBVertexBuffer() == VertexObjectId) + if (m_Driver->_DriverGLStates.getCurrBoundARBVertexBuffer() == m_VertexObjectId) { m_Driver->_DriverGLStates.forceBindARBVertexBuffer(0); } } - if (VertexObjectId) + if (m_VertexObjectId) { - GLuint id = (GLuint) VertexObjectId; + GLuint id = (GLuint)m_VertexObjectId; nlassert(nglIsBuffer(id)); nglDeleteBuffers(1, &id); } @@ -117,9 +117,9 @@ void *CVertexBufferGL3::lock() nglDeleteBuffers(1, &vertexBufferID); return &m_DummyVB[0];; } - VertexObjectId = vertexBufferID; + m_VertexObjectId = vertexBufferID; NLMISC::contReset(m_DummyVB); // free vector memory for real - nlassert(VertexObjectId); + nlassert(m_VertexObjectId); m_Invalid = false; m_Driver->_LostVBList.erase(m_IteratorInLostVBList); // continue to standard mapping code below .. @@ -129,7 +129,7 @@ void *CVertexBufferGL3::lock() { beforeLock= CTime::getPerformanceTime(); } - m_Driver->_DriverGLStates.bindARBVertexBuffer(VertexObjectId); + m_Driver->_DriverGLStates.bindARBVertexBuffer(m_VertexObjectId); // m_VertexPtr = nglMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); @@ -163,7 +163,7 @@ void *CVertexBufferGL3::lock() if (!m_VertexPtr) { nglUnmapBuffer(GL_ARRAY_BUFFER); - nlassert(nglIsBuffer((GLuint) VertexObjectId)); + nlassert(nglIsBuffer((GLuint)m_VertexObjectId)); invalidate(); return &m_DummyVB[0]; } @@ -190,13 +190,13 @@ void CVertexBufferGL3::unlock() m_VertexPtr = NULL; if (m_Invalid) return; - if (!VertexObjectId) return; + if (!m_VertexObjectId) return; TTicks beforeLock = 0; if (m_Driver->_VBHardProfiling) { beforeLock= CTime::getPerformanceTime(); } - m_Driver->_DriverGLStates.bindARBVertexBuffer(VertexObjectId); + m_Driver->_DriverGLStates.bindARBVertexBuffer(m_VertexObjectId); // double start = CTime::ticksToSecond(CTime::getPerformanceTime()); #ifdef NL_DEBUG _Unmapping = true; @@ -269,7 +269,7 @@ void CVertexBufferGL3::disable() void CVertexBufferGL3::initGL(uint vertexObjectID, CVertexBuffer::TPreferredMemory memType) { H_AUTO_OGL(CVertexBufferGLARB_initGL) - VertexObjectId = vertexObjectID; + m_VertexObjectId = vertexObjectID; m_MemType = memType; } @@ -277,7 +277,7 @@ void CVertexBufferGL3::initGL(uint vertexObjectID, CVertexBuffer::TPreferredMemo void CVertexBufferGL3::setupVBInfos(CVertexBufferInfo &vb) { H_AUTO_OGL(CVertexBufferGLARB_setupVBInfos) - vb.VertexObjectId = VertexObjectId; + vb.VertexObjectId = m_VertexObjectId; } // *************************************************************************** diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_vertex_buffer.h b/code/nel/src/3d/driver/opengl3/driver_opengl_vertex_buffer.h index 6be121d76..38275f534 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_vertex_buffer.h +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_vertex_buffer.h @@ -78,14 +78,13 @@ public: /// Setup ptrs allocated by createVBHard() void initGL(uint vertexObjectID, CVertexBuffer::TPreferredMemory memType); -public: - /// Get Handle of the ARB buffer. - uint getARBVertexObjectId() const { return VertexObjectId;} /// Invalidate the buffer (when it is lost, or when a lock fails) void invalidate(); private: + friend class CDriverGL3; + CVertexBuffer::TPreferredMemory m_MemType; void *m_VertexPtr; // pointer on current datas. Null if not locked @@ -94,8 +93,7 @@ private: // for use by CVertexArrayRange std::list::iterator m_IteratorInLostVBList; -public: - uint VertexObjectId; + uint m_VertexObjectId; }; #ifdef NL_STATIC