Bug 886667 - Just assert rather than aborting when our framebuffer is invalid. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Tue, 16 Jul 2013 15:56:10 -0400
changeset 138752 ef497a706a95f23c56fcf4b5c43c9b57c4aa526b
parent 138751 8bbd27688a89a52a0ae41177bc42d57a4fddc54a
child 138753 a2cdd84e44244a64dec3557b6f3fcfed471d8cda
push idunknown
push userunknown
push dateunknown
reviewersjrmuizel
bugs886667
milestone25.0a1
Bug 886667 - Just assert rather than aborting when our framebuffer is invalid. r=jrmuizel
gfx/layers/opengl/CompositingRenderTargetOGL.h
gfx/layers/opengl/CompositorOGL.cpp
--- a/gfx/layers/opengl/CompositingRenderTargetOGL.h
+++ b/gfx/layers/opengl/CompositingRenderTargetOGL.h
@@ -180,19 +180,19 @@ private:
                                mTextureHandle,
                                0);
 
     // Making this call to fCheckFramebufferStatus prevents a crash on
     // PowerVR. See bug 695246.
     GLenum result = mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
     if (result != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
       nsAutoCString msg;
-      msg.AppendPrintf("Framebuffer not complete -- error 0x%x, aFBOTextureTarget 0x%x, aRect.width %d, aRect.height %d",
-                       result, mInitParams.mFBOTextureTarget, mInitParams.mSize.width, mInitParams.mSize.height);
-      NS_RUNTIMEABORT(msg.get());
+      msg.AppendPrintf("Framebuffer not complete -- error 0x%x, aFBOTextureTarget 0x%x, mFBO %d, mTextureHandle %d, aRect.width %d, aRect.height %d",
+                       result, mInitParams.mFBOTextureTarget, mFBO, mTextureHandle, mInitParams.mSize.width, mInitParams.mSize.height);
+      NS_ERROR(msg.get());
     }
 
     mCompositor->PrepareViewport(mInitParams.mSize, mTransform);
     mGL->fScissor(0, 0, mInitParams.mSize.width, mInitParams.mSize.height);
     if (mInitParams.mInit == INIT_MODE_CLEAR) {
       mGL->fClearColor(0.0, 0.0, 0.0, 0.0);
       mGL->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
     }
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -891,16 +891,23 @@ CompositorOGL::CreateFBOWithTexture(cons
                               0,
                               LOCAL_GL_RGBA,
                               aRect.width, aRect.height,
                               0,
                               LOCAL_GL_RGBA,
                               LOCAL_GL_UNSIGNED_BYTE,
                               buf);
     }
+    GLenum error = mGLContext->GetAndClearError();
+    if (error != LOCAL_GL_NO_ERROR) {
+      nsAutoCString msg;
+      msg.AppendPrintf("Texture initialization failed! -- error 0x%x, Source %d, Source format %d,  RGBA Compat %d",
+                       error, aSourceFrameBuffer, format, isFormatCompatibleWithRGBA);
+      NS_ERROR(msg.get());
+    }
   } else {
     mGLContext->fTexImage2D(mFBOTextureTarget,
                             0,
                             LOCAL_GL_RGBA,
                             aRect.width, aRect.height,
                             0,
                             LOCAL_GL_RGBA,
                             LOCAL_GL_UNSIGNED_BYTE,