From 1b51a23d098d8b8c563626a51430d5dfa0d0a874 Mon Sep 17 00:00:00 2001 From: joilnen Date: Sun, 12 Nov 2023 22:57:56 -0300 Subject: [PATCH 1/3] range loop refactoring --- .../GLSupport/src/EGL/OgreEGLSupport.cpp | 19 +++++++------------ .../GLSupport/src/OgreGLVertexArrayObject.cpp | 16 +++------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/RenderSystems/GLSupport/src/EGL/OgreEGLSupport.cpp b/RenderSystems/GLSupport/src/EGL/OgreEGLSupport.cpp index d9ee1fbce22..01a63f15dfb 100755 --- a/RenderSystems/GLSupport/src/EGL/OgreEGLSupport.cpp +++ b/RenderSystems/GLSupport/src/EGL/OgreEGLSupport.cpp @@ -210,13 +210,10 @@ namespace Ogre { void load(EGLSupport* const glSupport, EGLConfig glConfig) { - std::map::iterator it; - - for (it = fields.begin(); it != fields.end(); it++) + for (auto& f : fields) { - it->second = EGL_NONE; - - glSupport->getGLConfigAttrib(glConfig, it->first, &it->second); + f.second = EGL_NONE; + glSupport->getGLConfigAttrib(glConfig, f.first, &f.second); } } @@ -237,12 +234,10 @@ namespace Ogre { } } - std::map::iterator it; - - for (it = fields.begin(); it != fields.end(); it++) + for (auto& f : fields) { - if (it->first != EGL_CONFIG_CAVEAT && - fields[it->first] > alternative.fields[it->first]) + if (f.first != EGL_CONFIG_CAVEAT && + fields[f.first] > alternative.fields[f.first]) { return true; } @@ -312,7 +307,7 @@ namespace Ogre { ::EGLContext EGLSupport::createNewContext(EGLDisplay eglDisplay, ::EGLConfig glconfig, - ::EGLContext shareList) const + ::EGLContext shareList) const { EGLint contextAttrs[] = { EGL_CONTEXT_MAJOR_VERSION, 3, diff --git a/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp b/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp index f9df00cfdeb..1ee953766c7 100644 --- a/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp +++ b/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp @@ -43,7 +43,7 @@ namespace Ogre { rs->_destroyVao(mCreatorContext, mVAO); } } - + void GLVertexArrayObject::bind(GLRenderSystemCommon* rs) { if(mCreatorContext && mCreatorContext != rs->_getCurrentContext()) // VAO is unusable with current context, destroy it @@ -69,13 +69,8 @@ namespace Ogre { if(mNeedsUpdate) return true; - VertexDeclaration::VertexElementList::const_iterator elemIter, elemEnd; - elemEnd = mElementList.end(); - - for (elemIter = mElementList.begin(); elemIter != elemEnd; ++elemIter) + for (auto& elem : mElementList) { - const VertexElement & elem = *elemIter; - uint16 source = elem.getSource(); if (!vertexBufferBinding->isBufferBound(source)) @@ -111,13 +106,8 @@ namespace Ogre { mAttribsBound.clear(); mInstanceAttribsBound.clear(); - VertexDeclaration::VertexElementList::const_iterator elemIter, elemEnd; - elemEnd = mElementList.end(); - - for (elemIter = mElementList.begin(); elemIter != elemEnd; ++elemIter) + for (auto& elem : mElementList) { - const VertexElement& elem = *elemIter; - uint16 source = elem.getSource(); if (!vertexBufferBinding->isBufferBound(source)) From 8a3d5d38dbd0096c39f681a781d989a4a7f82857 Mon Sep 17 00:00:00 2001 From: Joilnen Date: Mon, 13 Nov 2023 22:16:18 -0300 Subject: [PATCH 2/3] Update RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp Co-authored-by: Pavel Rojtberg --- RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp b/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp index 1ee953766c7..ed59dc84aaf 100644 --- a/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp +++ b/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp @@ -69,7 +69,7 @@ namespace Ogre { if(mNeedsUpdate) return true; - for (auto& elem : mElementList) + for (const auto& elem : mElementList) { uint16 source = elem.getSource(); From b2959182febe109bc902c7daed264c696d72b7dd Mon Sep 17 00:00:00 2001 From: Joilnen Date: Tue, 14 Nov 2023 13:24:13 -0300 Subject: [PATCH 3/3] Update RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp Co-authored-by: Pavel Rojtberg --- RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp b/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp index ed59dc84aaf..d4088fbe68d 100644 --- a/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp +++ b/RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp @@ -106,7 +106,7 @@ namespace Ogre { mAttribsBound.clear(); mInstanceAttribsBound.clear(); - for (auto& elem : mElementList) + for (const auto& elem : mElementList) { uint16 source = elem.getSource();