Bug 1247977: More information when we hit the OpenGL error in FakeBlackTexture. r=jgilbert
authorMilan Sreckovic <milan@mozilla.com>
Fri, 01 Apr 2016 10:13:25 -0400
changeset 291888 a65e1d378c8e8f66fa373266db9b2167c06e66c1
parent 291887 e6d9e7a97079d67a8794d1eb0b9b7e516ebfff71
child 291889 305f923c6f9c953518c9e8bcfb70bcae3c7f8af8
push id74713
push usermsreckovic@mozilla.com
push dateWed, 06 Apr 2016 14:08:27 +0000
treeherdermozilla-inbound@a65e1d378c8e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1247977
milestone48.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 1247977: More information when we hit the OpenGL error in FakeBlackTexture. r=jgilbert MozReview-Commit-ID: I9RvZ9HD7NE
dom/canvas/WebGLContextDraw.cpp
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -836,29 +836,44 @@ WebGLContext::FakeBlackTexture::FakeBlac
     // We allocate our zeros on the heap, and we overallocate (16 bytes instead of 4) to
     // minimize the risk of running into a driver bug in texImage2D, as it is a bit
     // unusual maybe to create 1x1 textures, and the stack may not have the alignment that
     // TexImage2D expects.
 
     const webgl::DriverUnpackInfo dui = {texFormat, texFormat, LOCAL_GL_UNSIGNED_BYTE};
     UniqueBuffer zeros = moz_xcalloc(1, 16); // Infallible allocation.
 
+    MOZ_ASSERT(gl->IsCurrent());
     if (target == LOCAL_GL_TEXTURE_CUBE_MAP) {
         for (int i = 0; i < 6; ++i) {
             const TexImageTarget curTarget = LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
             const GLenum error = DoTexImage(mGL, curTarget.get(), 0, &dui, 1, 1, 1,
                                             zeros.get());
-            if (error)
-                MOZ_CRASH("Unexpected error during FakeBlack creation.");
+            if (error) {
+                const nsPrintfCString text("DoTexImage failed with `error`: 0x%04x, "
+                                           "for `curTarget`: 0x%04x, "
+                                           "`dui`: {0x%04x, 0x%04x, 0x%04x}.",
+                                           error, curTarget.get(), dui.internalFormat,
+                                           dui.unpackFormat, dui.unpackType);
+                gfxCriticalError() << text.BeginReading();
+                MOZ_CRASH("Unexpected error during cube map FakeBlack creation.");
+            }
         }
     } else {
         const GLenum error = DoTexImage(mGL, target.get(), 0, &dui, 1, 1, 1,
                                         zeros.get());
-        if (error)
+        if (error) {
+            const nsPrintfCString text("DoTexImage failed with `error`: 0x%04x, "
+                                       "for `target`: 0x%04x, "
+                                       "`dui`: {0x%04x, 0x%04x, 0x%04x}.",
+                                       error, target.get(), dui.internalFormat,
+                                       dui.unpackFormat, dui.unpackType);
+            gfxCriticalError() << text.BeginReading();
             MOZ_CRASH("Unexpected error during FakeBlack creation.");
+        }
     }
 }
 
 WebGLContext::FakeBlackTexture::~FakeBlackTexture()
 {
     mGL->MakeCurrent();
     mGL->fDeleteTextures(1, &mGLName);
 }