]> git.cworth.org Git - apitrace/commitdiff
glstate: Use helper function for flushing GL errors.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 7 Jun 2013 07:55:03 +0000 (08:55 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 7 Jun 2013 07:57:45 +0000 (08:57 +0100)
retrace/glstate_params.py

index 9e4fab0fdaed5281c5065b082ece32e4800581cc..54e0c673e22b822356fe18b2ed63eeef0a0ec439 100644 (file)
@@ -280,6 +280,12 @@ class StateDumper:
         print 'namespace glstate {'
         print
 
+        print 'static void'
+        print 'flushErrors(void) {'
+        print '    while (glGetError() != GL_NO_ERROR) {}'
+        print '}'
+        print
+
         print 'void'
         print 'dumpBoolean(JSONWriter &json, GLboolean value)'
         print '{'
@@ -540,11 +546,11 @@ class StateDumper:
 
         print '        // %s' % name
         print '        {'
-        print '            while (glGetError() != GL_NO_ERROR) {}'
+        print '            flushErrors();'
         type, value = getter(*args)
         print '            if (glGetError() != GL_NO_ERROR) {'
         #print '                std::cerr << "warning: %s(%s) failed\\n";' % (inflection, name)
-        print '                while (glGetError() != GL_NO_ERROR) {}'
+        print '                flushErrors();'
         print '            } else {'
         print '                json.beginMember("%s");' % name
         JsonWriter().visit(type, value)