Bug 769949 - GuaranteeResolve() must BlitDirtyFBOs() - r=bjacob
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 06 Jul 2012 16:38:16 -0700
changeset 98572 921d27b8a76e83cee2023dfb2c3fa501ad49ab14
parent 98571 675fdcfc540abb65d745d760c8cd88baa34cef12
child 98573 88070ff09ccd685ece07d0219eccc6e7992be145
push id11543
push userjgilbert@mozilla.com
push dateFri, 06 Jul 2012 23:38:49 +0000
treeherdermozilla-inbound@921d27b8a76e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs769949
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 769949 - GuaranteeResolve() must BlitDirtyFBOs() - r=bjacob
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -1767,17 +1767,17 @@ static already_AddRefed<gfxImageSurface>
   ctx->Paint();
   return temp.forget();
 }
 
 already_AddRefed<gfxImageSurface>
 GLContext::GetTexImage(GLuint aTexture, bool aYInvert, ShaderProgramType aShader)
 {
     MakeCurrent();
-    fFinish();
+    GuaranteeResolve();
     fActiveTexture(LOCAL_GL_TEXTURE0);
     fBindTexture(LOCAL_GL_TEXTURE_2D, aTexture);
 
     gfxIntSize size;
     fGetTexLevelParameteriv(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_TEXTURE_WIDTH, &size.width);
     fGetTexLevelParameteriv(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_TEXTURE_HEIGHT, &size.height);
     
     nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(size, gfxASurface::ImageFormatARGB32);
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -492,18 +492,17 @@ struct THEBES_API ContextFormat
 class GLContext
     : public GLLibraryLoader
 {
     NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GLContext)
 public:
     GLContext(const ContextFormat& aFormat,
               bool aIsOffscreen = false,
               GLContext *aSharedContext = nsnull)
-      : mFlushGuaranteesResolve(false),
-        mUserBoundDrawFBO(0),
+      : mUserBoundDrawFBO(0),
         mUserBoundReadFBO(0),
         mInternalBoundDrawFBO(0),
         mInternalBoundReadFBO(0),
 #ifdef DEBUG
         mInInternalBindingMode_DrawFBO(true),
         mInInternalBindingMode_ReadFBO(true),
 #endif
         mOffscreenFBOsDirty(false),
@@ -779,33 +778,21 @@ public:
         return true;
     }
 
     virtual void UnbindTex2DOffscreen(GLContext *aOffscreen) { }
 
     bool IsOffscreen() {
         return mIsOffscreen;
     }
-
-private:
-    bool mFlushGuaranteesResolve;
-
-public:
-    void SetFlushGuaranteesResolve(bool aFlushGuaranteesResolve) {
-        mFlushGuaranteesResolve = aFlushGuaranteesResolve;
-    }
     
     // Before reads from offscreen texture
     void GuaranteeResolve() {
-        if (mFlushGuaranteesResolve) {
-            BlitDirtyFBOs();
-            fFlush();
-        } else {
-            fFinish();
-        }
+        BlitDirtyFBOs();
+        fFinish();
     }
 
     /*
      * Resize the current offscreen buffer.  Returns true on success.
      * If it returns false, the context should be treated as unusable
      * and should be recreated.  After the resize, the viewport is not
      * changed; glViewport should be called as appropriate.
      *
@@ -1215,22 +1202,16 @@ public:
 
         BeforeGLReadCall();
         // no-op; we just want to make sure the Read FBO is updated if it needs to be
         AfterGLReadCall();
 
         BindUserReadFBO(read);
     }
 
-    void fFinish() {
-        BeforeGLReadCall();
-        raw_fFinish();
-        AfterGLReadCall();
-    }
-
     // Draw/Read
     void fBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) {
         BeforeGLDrawCall();
         BeforeGLReadCall();
         raw_fBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
         AfterGLReadCall();
         AfterGLDrawCall();
     }
@@ -2200,17 +2181,17 @@ public:
     }
 
     void fEnableVertexAttribArray(GLuint index) {
         BEFORE_GL_CALL;
         mSymbols.fEnableVertexAttribArray(index);
         AFTER_GL_CALL;
     }
 
-    void raw_fFinish() {
+    void fFinish() {
         BEFORE_GL_CALL;
         mSymbols.fFinish();
         AFTER_GL_CALL;
     }
 
     void fFlush() {
         BEFORE_GL_CALL;
         mSymbols.fFlush();