Bug 1390386 - fGetError should use BEFORE_GL_CALL. - r=jrmuizel draft
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 17 Aug 2017 15:01:27 -0700
changeset 648553 996a87b353f780ae567cd00d105851402fc091c9
parent 646945 c7728505f475e7adbd9c33df8d8bd208995a0a37
child 726856 b9f623f3ad6a022ab49d46762ae80ff1edfb9468
push id74791
push userbmo:jgilbert@mozilla.com
push dateThu, 17 Aug 2017 23:10:01 +0000
reviewersjrmuizel
bugs1390386
milestone57.0a1
Bug 1390386 - fGetError should use BEFORE_GL_CALL. - r=jrmuizel MozReview-Commit-ID: B8sR38Bzjb5
gfx/gl/GLContext.h
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -562,36 +562,27 @@ private:
         GLenum err = RawGetError();
 
         if (err)
             while (RawGetError()) {}
 
         return err;
     }
 
-public:
     GLenum FlushErrors() const {
         GLenum err = RawGetErrorAndClear();
         if (!mTopError)
             mTopError = err;
         return err;
     }
 
-    // We smash all errors together, so you never have to loop on this. We
-    // guarantee that immediately after this call, there are no errors left.
-    GLenum fGetError() {
-        FlushErrors();
-
-        GLenum err = mTopError;
-        mTopError = LOCAL_GL_NO_ERROR;
-        return err;
-    }
-
     ////////////////////////////////////
     // Use this safer option.
+
+public:
     class LocalErrorScope;
 
 private:
     std::stack<const LocalErrorScope*> mLocalErrorScopeStack;
 
 public:
     class LocalErrorScope {
         GLContext& mGL;
@@ -778,16 +769,29 @@ public:
         return mSyncGLCallCount;
     }
 
     void ResetSyncCallCount(const char* resetReason) const;
 
 // -----------------------------------------------------------------------------
 // GL official entry points
 public:
+    // We smash all errors together, so you never have to loop on this. We
+    // guarantee that immediately after this call, there are no errors left.
+    GLenum fGetError() {
+        GLenum err = LOCAL_GL_CONTEXT_LOST;
+        BEFORE_GL_CALL;
+
+        FlushErrors();
+        err = mTopError;
+        mTopError = LOCAL_GL_NO_ERROR;
+
+        AFTER_GL_CALL;
+        return err;
+    }
 
     void fActiveTexture(GLenum texture) {
         BEFORE_GL_CALL;
         mSymbols.fActiveTexture(texture);
         AFTER_GL_CALL;
     }
 
     void fAttachShader(GLuint program, GLuint shader) {