b=1009960, teach ScopedBindFramebuffer about spilt read/draw framebuffers; r=bjacob
authorVladimir Vukicevic <vladimir@pobox.com>
Tue, 13 May 2014 17:14:53 -0700
changeset 192430 96b016800f62d8499745cfe6c8a173b6c0531862
parent 192429 225cc2ec22317156acd2bc5842f9c611a44da61f
child 192431 0c408ede302a57efe82efa9c046389b5cc3ce106
push id27086
push userttaubert@mozilla.com
push dateSun, 06 Jul 2014 16:11:25 +0000
treeherderautoland@9f59e39f70a5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs1009960
milestone33.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
b=1009960, teach ScopedBindFramebuffer about spilt read/draw framebuffers; r=bjacob
gfx/gl/ScopedGLHelpers.cpp
gfx/gl/ScopedGLHelpers.h
--- a/gfx/gl/ScopedGLHelpers.cpp
+++ b/gfx/gl/ScopedGLHelpers.cpp
@@ -47,17 +47,22 @@ ScopedGLState::UnwrapImpl()
 }
 
 
 /* ScopedBindFramebuffer - Saves and restores with GetUserBoundFB and BindUserFB. */
 
 void
 ScopedBindFramebuffer::Init()
 {
-    mOldFB = mGL->GetFB();
+    if (mGL->IsSupported(GLFeature::framebuffer_blit)) {
+        mOldReadFB = mGL->GetReadFB();
+        mOldDrawFB = mGL->GetDrawFB();
+    } else {
+        mOldReadFB = mOldDrawFB = mGL->GetFB();
+    }
 }
 
 ScopedBindFramebuffer::ScopedBindFramebuffer(GLContext* aGL)
     : ScopedGLWrapper<ScopedBindFramebuffer>(aGL)
 {
     Init();
 }
 
@@ -69,17 +74,22 @@ ScopedBindFramebuffer::ScopedBindFramebu
 }
 
 void
 ScopedBindFramebuffer::UnwrapImpl()
 {
     // Check that we're not falling out of scope after the current context changed.
     MOZ_ASSERT(mGL->IsCurrent());
 
-    mGL->BindFB(mOldFB);
+    if (mOldReadFB == mOldDrawFB) {
+        mGL->BindFB(mOldDrawFB);
+    } else {
+        mGL->BindDrawFB(mOldDrawFB);
+        mGL->BindReadFB(mOldReadFB);
+    }
 }
 
 
 /* ScopedBindTextureUnit ******************************************************/
 
 ScopedBindTextureUnit::ScopedBindTextureUnit(GLContext* aGL, GLenum aTexUnit)
     : ScopedGLWrapper<ScopedBindTextureUnit>(aGL)
 {
--- a/gfx/gl/ScopedGLHelpers.h
+++ b/gfx/gl/ScopedGLHelpers.h
@@ -69,17 +69,18 @@ protected:
 
 // Saves and restores with GetUserBoundFB and BindUserFB.
 struct ScopedBindFramebuffer
     : public ScopedGLWrapper<ScopedBindFramebuffer>
 {
     friend struct ScopedGLWrapper<ScopedBindFramebuffer>;
 
 protected:
-    GLuint mOldFB;
+    GLuint mOldReadFB;
+    GLuint mOldDrawFB;
 
 private:
     void Init();
 
 public:
     explicit ScopedBindFramebuffer(GLContext* aGL);
     ScopedBindFramebuffer(GLContext* aGL, GLuint aNewFB);