[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann sbergman at redhat.com
Thu Aug 27 03:15:28 PDT 2015


 vcl/source/opengl/OpenGLHelper.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 44994d951179f5cf32db7ead8912c3fd0e7e2afd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Aug 27 12:13:05 2015 +0200

    Fully drain glGetError
    
    ...according to <https://www.opengl.org/sdk/docs/man/html/glGetError.xhtml>:
    "To allow for distributed implementations, there may be several error flags. If
    any single error flag has recorded an error, the value of that flag is returned
    and that flag is reset to GL_NO_ERROR when glGetError is called. If more than
    one flag has recorded an error, glGetError returns and clears an arbitrary error
    flag value. Thus, glGetError should always be called in a loop, until it returns
    GL_NO_ERROR, if all error flags are to be reset."
    
    (The original code was flagged by clang-tidy's
    clang-analyzer-deadcode.DeadStores.)
    
    Change-Id: Ia64e2133b6a4581230b999d4b8b63aa59199ee32

diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 717a7ba..f669fba 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -399,17 +399,19 @@ void OpenGLHelper::checkGLError(const char* pFile, size_t nLine)
 {
     OpenGLZone aZone;
 
-    GLenum glErr = glGetError();
-    if (glErr != GL_NO_ERROR)
+    for (;;)
     {
+        GLenum glErr = glGetError();
+        if (glErr == GL_NO_ERROR)
+        {
+            break;
+        }
         const char* sError = OpenGLHelper::GLErrorString(glErr);
 
         if (sError)
             SAL_WARN("vcl.opengl", "GL Error #" << glErr << "(" << sError << ") in File " << pFile << " at line: " << nLine);
         else
             SAL_WARN("vcl.opengl", "GL Error #" << glErr << " (no message available) in File " << pFile << " at line: " << nLine);
-
-        glErr = glGetError();
     }
 }
 


More information about the Libreoffice-commits mailing list