Bug 928697 - Fix crash in deferred WebGL texture initialization - r=jgilbert, a=bbajaj
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 31 Oct 2013 13:00:32 -0400
changeset 167305 12e87b3b86c63ec13d26a2f9fb17595261301461
parent 167304 8f6d7f3350c3e3cfcd1c6799be7925f5d770ab1b
child 167306 dee754949ca0a432d55da36d3f9ece8d92012e71
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, bbajaj
bugs928697
milestone27.0a2
Bug 928697 - Fix crash in deferred WebGL texture initialization - r=jgilbert, a=bbajaj
content/canvas/src/WebGLTexture.cpp
--- a/content/canvas/src/WebGLTexture.cpp
+++ b/content/canvas/src/WebGLTexture.cpp
@@ -423,21 +423,24 @@ WebGLTexture::DoDeferredImageInitializat
     CheckedUint32 checked_byteLength
         = WebGLContext::GetImageSize(
                         imageInfo.mHeight,
                         imageInfo.mWidth,
                         texelsize,
                         mContext->mPixelStoreUnpackAlignment);
     MOZ_ASSERT(checked_byteLength.isValid()); // should have been checked earlier
     void *zeros = calloc(1, checked_byteLength.value());
-    GLenum error
-        = mContext->CheckedTexImage2D(imageTarget, level, imageInfo.mFormat,
-                                      imageInfo.mWidth, imageInfo.mHeight,
-                                      0, imageInfo.mFormat, imageInfo.mType,
-                                      zeros);
+
+    mContext->UpdateWebGLErrorAndClearGLError();
+    mContext->gl->fTexImage2D(imageTarget, level, imageInfo.mFormat,
+                              imageInfo.mWidth, imageInfo.mHeight,
+                              0, imageInfo.mFormat, imageInfo.mType,
+                              zeros);
+    GLenum error = LOCAL_GL_NO_ERROR;
+    mContext->UpdateWebGLErrorAndClearGLError(&error);
 
     free(zeros);
     SetImageDataStatus(imageTarget, level, WebGLImageDataStatus::InitializedImageData);
 
     if (error) {
       // Should only be OUT_OF_MEMORY. Anyway, there's no good way to recover from this here.
       MOZ_CRASH(); // errors on texture upload have been related to video memory exposure in the past.
       return;