Bug 880734 - Assert bound to correct FB in FB funcs, and bind the correct FB on Mesa. - r=bjacob
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 21 Jun 2013 16:42:32 -0700
changeset 147534 8f0aee7807f90b3c7f98f7d918baa37026156f6b
parent 147533 d3ca13f229af64dd2d09bf20382e2ae62b7d9ab3
child 147535 e0f60aa72a86289ab8c8c5cc2821b5f3032366a1
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs880734
milestone24.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 880734 - Assert bound to correct FB in FB funcs, and bind the correct FB on Mesa. - r=bjacob
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/WebGLFramebuffer.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -39,16 +39,17 @@
 #if defined(MOZ_WIDGET_COCOA)
 #include "nsCocoaFeatures.h"
 #endif
 
 #include "mozilla/dom/BindingUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
+using namespace mozilla::gl;
 
 static bool BaseTypeAndSizeFromUniformType(WebGLenum uType, WebGLenum *baseType, WebGLint *unitSize);
 static WebGLenum InternalFormatForFormatAndType(WebGLenum format, WebGLenum type, bool isGLES2);
 
 // For a Tegra workaround.
 static const int MAX_DRAW_CALLS_SINCE_FLUSH = 100;
 
 //
@@ -5526,34 +5527,34 @@ WebGLContext::ReattachTextureToAnyFrameb
     for(WebGLFramebuffer *framebuffer = mFramebuffers.getFirst();
         framebuffer;
         framebuffer = framebuffer->getNext())
     {
         size_t colorAttachmentCount = framebuffer->mColorAttachments.Length();
         for (size_t i = 0; i < colorAttachmentCount; i++)
         {
             if (framebuffer->ColorAttachment(i).Texture() == tex) {
-                gl::ScopedBindFramebuffer autoFB(gl, framebuffer->GLName());
+                ScopedBindFramebuffer autoFB(gl, framebuffer->GLName());
                 framebuffer->FramebufferTexture2D(
                   LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0 + i,
                   tex->Target(), tex, level);
             }
         }
         if (framebuffer->DepthAttachment().Texture() == tex) {
-            gl::ScopedBindFramebuffer autoFB(gl, framebuffer->GLName());
+            ScopedBindFramebuffer autoFB(gl, framebuffer->GLName());
             framebuffer->FramebufferTexture2D(
               LOCAL_GL_FRAMEBUFFER, LOCAL_GL_DEPTH_ATTACHMENT,
               tex->Target(), tex, level);
         }
         if (framebuffer->StencilAttachment().Texture() == tex) {
-            gl::ScopedBindFramebuffer autoFB(gl, framebuffer->GLName());
+            ScopedBindFramebuffer autoFB(gl, framebuffer->GLName());
             framebuffer->FramebufferTexture2D(
               LOCAL_GL_FRAMEBUFFER, LOCAL_GL_STENCIL_ATTACHMENT,
               tex->Target(), tex, level);
         }
         if (framebuffer->DepthStencilAttachment().Texture() == tex) {
-            gl::ScopedBindFramebuffer autoFB(gl, framebuffer->GLName());
+            ScopedBindFramebuffer autoFB(gl, framebuffer->GLName());
             framebuffer->FramebufferTexture2D(
               LOCAL_GL_FRAMEBUFFER, LOCAL_GL_DEPTH_STENCIL_ATTACHMENT,
               tex->Target(), tex, level);
         }
     }
 }
--- a/content/canvas/src/WebGLFramebuffer.cpp
+++ b/content/canvas/src/WebGLFramebuffer.cpp
@@ -158,16 +158,17 @@ WebGLFramebuffer::Delete() {
 }
 
 void
 WebGLFramebuffer::FramebufferRenderbuffer(WebGLenum target,
                              WebGLenum attachment,
                              WebGLenum rbtarget,
                              WebGLRenderbuffer *wrb)
 {
+    MOZ_ASSERT(mContext->mBoundFramebuffer == this);
     if (!mContext->ValidateObjectAllowNull("framebufferRenderbuffer: renderbuffer", wrb))
     {
         return;
     }
 
     if (target != LOCAL_GL_FRAMEBUFFER)
         return mContext->ErrorInvalidEnumInfo("framebufferRenderbuffer: target", target);
 
@@ -218,16 +219,17 @@ WebGLFramebuffer::FramebufferRenderbuffe
 
 void
 WebGLFramebuffer::FramebufferTexture2D(WebGLenum target,
                           WebGLenum attachment,
                           WebGLenum textarget,
                           WebGLTexture *wtex,
                           WebGLint level)
 {
+    MOZ_ASSERT(mContext->mBoundFramebuffer == this);
     if (!mContext->ValidateObjectAllowNull("framebufferTexture2D: texture",
                                            wtex))
     {
         return;
     }
 
     if (target != LOCAL_GL_FRAMEBUFFER)
         return mContext->ErrorInvalidEnumInfo("framebufferTexture2D: target", target);
@@ -378,16 +380,17 @@ WebGLFramebuffer::DetachRenderbuffer(con
         FramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_STENCIL_ATTACHMENT, LOCAL_GL_RENDERBUFFER, nullptr);
     if (mDepthStencilAttachment.Renderbuffer() == rb)
         FramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_DEPTH_STENCIL_ATTACHMENT, LOCAL_GL_RENDERBUFFER, nullptr);
 }
 
 bool
 WebGLFramebuffer::CheckAndInitializeRenderbuffers()
 {
+    MOZ_ASSERT(mContext->mBoundFramebuffer == this);
     // enforce WebGL section 6.5 which is WebGL-specific, hence OpenGL itself would not
     // generate the INVALID_FRAMEBUFFER_OPERATION that we need here
     if (HasDepthStencilConflict())
         return false;
 
     if (HasIncompleteAttachment())
         return false;