Bug 793126 - import ANGLE r1278 to get the fix for ANGLE bug 350, a WebGL crasher - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 24 Oct 2012 16:26:54 -0400
changeset 111422 94ea624a1d8e0df74c58340f3ff87e9bfbdbbb6e
parent 111421 88693039c414a95fe2c6cbecdd3adee85a6fdf39
child 111423 0689e804a40e768ca3ce2f365d79883d6f9221a5
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjgilbert
bugs793126, 350
milestone19.0a1
Bug 793126 - import ANGLE r1278 to get the fix for ANGLE bug 350, a WebGL crasher - r=jgilbert
gfx/angle/README.mozilla
gfx/angle/src/libGLESv2/Texture.cpp
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -27,16 +27,19 @@ In this order:
   angle-abort-on-oom-in-preprocessor.patch
     see bug 680840. Probably not useful anymore now that we're on the new
     preprocessor, but it doesn't hurt to keep it around a bit longer.
 
   angle-faceforward-emu.patch
     See bug 771406. Adds emulation for faceforward(float,float,float),
     which is needed to prevent crashing on Mac+Intel.
 
+  angle-r1278.patch
+    Imports ANGLE r1278, which fixes ANGLE bug 350, a crasher.
+
 In addition to these patches, the Makefile.in files are ours, they're not present in
 upsteam ANGLE. Therefore, changes made to the Makefile.in files should not be stored
 in the local .patch files.
 
 == How to update this ANGLE copy ==
 
 1. Unapply patches
 
--- a/gfx/angle/src/libGLESv2/Texture.cpp
+++ b/gfx/angle/src/libGLESv2/Texture.cpp
@@ -1907,16 +1907,20 @@ IDirect3DBaseTexture9 *Texture2D::getBas
     return mTexStorage ? mTexStorage->getBaseTexture() : NULL;
 }
 
 // Constructs a Direct3D 9 texture resource from the texture images
 void Texture2D::createTexture()
 {
     GLsizei width = mImageArray[0].getWidth();
     GLsizei height = mImageArray[0].getHeight();
+
+    if (!(width > 0 && height > 0))
+        return; // do not attempt to create d3d textures for nonexistant data
+
     GLint levels = creationLevels(width, height);
     D3DFORMAT d3dfmt = mImageArray[0].getD3DFormat();
     DWORD d3dusage = GetTextureUsage(d3dfmt, mUsage, false);
 
     delete mTexStorage;
     mTexStorage = new TextureStorage2D(levels, d3dfmt, d3dusage, width, height);
     
     if (mTexStorage->isManaged())
@@ -2467,16 +2471,20 @@ IDirect3DBaseTexture9 *TextureCubeMap::g
 {
     return mTexStorage ? mTexStorage->getBaseTexture() : NULL;
 }
 
 // Constructs a Direct3D 9 texture resource from the texture images, or returns an existing one
 void TextureCubeMap::createTexture()
 {
     GLsizei size = mImageArray[0][0].getWidth();
+
+    if (!(size > 0))
+        return; // do not attempt to create d3d textures for nonexistant data
+
     GLint levels = creationLevels(size, 0);
     D3DFORMAT d3dfmt = mImageArray[0][0].getD3DFormat();
     DWORD d3dusage = GetTextureUsage(d3dfmt, mUsage, false);
 
     delete mTexStorage;
     mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, d3dusage, size);
 
     if (mTexStorage->isManaged())