Bug 696768 - Abort when framebuffer completeness check fails. r=jrmuizel
authorAli Juma <ajuma@mozilla.com>
Wed, 02 Nov 2011 09:40:14 -0400
changeset 79570 debd724ba3c889fef41c69211862fee8cb2e6bd2
parent 79569 df8fb0f7eb07a95e5480a5aaf8c2d5c204b0fcca
child 79571 1cab0ad00ce7ddb46b5843850f91516499f22120
push id3055
push userajuma@mozilla.com
push dateWed, 02 Nov 2011 13:47:54 +0000
treeherdermozilla-inbound@1cab0ad00ce7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs696768
milestone10.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 696768 - Abort when framebuffer completeness check fails. r=jrmuizel
gfx/layers/opengl/LayerManagerOGL.cpp
gfx/thebes/GLContext.cpp
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -991,18 +991,20 @@ LayerManagerOGL::SetupBackBuffer(int aWi
 
   mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mBackBufferFBO);
   mGLContext->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER,
                                     LOCAL_GL_COLOR_ATTACHMENT0,
                                     mFBOTextureTarget,
                                     mBackBufferTexture,
                                     0);
 
-  NS_ASSERTION(mGLContext->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER) ==
-               LOCAL_GL_FRAMEBUFFER_COMPLETE, "Error setting up framebuffer.");
+  if (mGLContext->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER) !=
+      LOCAL_GL_FRAMEBUFFER_COMPLETE) {
+    NS_RUNTIMEABORT("Error setting up framebuffer --- framebuffer not complete");
+  }
 
   mBackBufferSize.width = aWidth;
   mBackBufferSize.height = aHeight;
 }
 
 void
 LayerManagerOGL::CopyToTarget()
 {
@@ -1150,18 +1152,22 @@ LayerManagerOGL::CreateFBOWithTexture(co
   mGLContext->fGenFramebuffers(1, &fbo);
   mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, fbo);
   mGLContext->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER,
                                     LOCAL_GL_COLOR_ATTACHMENT0,
                                     mFBOTextureTarget,
                                     tex,
                                     0);
 
-  NS_ASSERTION(mGLContext->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER) ==
-               LOCAL_GL_FRAMEBUFFER_COMPLETE, "Error setting up framebuffer.");
+  // Making this call to fCheckFramebufferStatus prevents a crash on
+  // PowerVR. See bug 695246.
+  if (mGLContext->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER) !=
+      LOCAL_GL_FRAMEBUFFER_COMPLETE) {
+    NS_RUNTIMEABORT("Error setting up framebuffer --- framebuffer not complete");
+  }
 
   SetupPipeline(aRect.width, aRect.height, DontApplyWorldTransform);
   mGLContext->fScissor(0, 0, aRect.width, aRect.height);
 
   if (aInit == InitModeClear) {
     mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
     mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
   }
--- a/gfx/thebes/GLContext.cpp
+++ b/gfx/thebes/GLContext.cpp
@@ -2425,24 +2425,24 @@ GLContext::SetBlitFramebufferForDestText
 
     fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mBlitFramebuffer);
     fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER,
                           LOCAL_GL_COLOR_ATTACHMENT0,
                           LOCAL_GL_TEXTURE_2D,
                           aTexture,
                           0);
 
-    if (aTexture) {
-        DebugOnly<GLenum> status = fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
+    if (aTexture && (fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER) !=
+                     LOCAL_GL_FRAMEBUFFER_COMPLETE)) {
 
-        // Note: if you are hitting this assertion, it is likely that
+        // Note: if you are hitting this, it is likely that
         // your texture is not texture complete -- that is, you
         // allocated a texture name, but didn't actually define its
         // size via a call to TexImage2D.
-        NS_ASSERTION(status == LOCAL_GL_FRAMEBUFFER_COMPLETE, "Framebuffer not complete!");
+        NS_RUNTIMEABORT("Error setting up framebuffer --- framebuffer not complete!");
     }
 }
 
 #ifdef DEBUG
 
 void
 GLContext::CreatedProgram(GLContext *aOrigin, GLuint aName)
 {