Bug 928697 - Fix crash in deferred WebGL texture initialization - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 31 Oct 2013 13:00:32 -0400
changeset 153028 3bf04be3cbe5053fc4af1423fce27656623456ef
parent 153027 2137bf09cdc1d15daeb6a220e94e76495edfa0b4
child 153029 229f179bd8d7244cd863e90e4d89d9b57f2d7a69
push id25566
push userryanvm@gmail.com
push dateFri, 01 Nov 2013 18:40:05 +0000
treeherdermozilla-central@5bb07c1ae9f5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs928697
milestone28.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 928697 - Fix crash in deferred WebGL texture initialization - r=jgilbert
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;