Backed out changeset 5b70ccd12b42 (bug 1305832) for webgl failures
authorPhil Ringnalda <philringnalda@gmail.com>
Wed, 30 Nov 2016 20:14:13 -0800
changeset 324967 0a3b96cee2eaeeaabd71ce228c25d9d555e2e04a
parent 324966 b1d875f4c6738d8dfc6c309188514ab4df934ab7
child 324968 033d5532cac71ffdc9459fbf21f628448fac3b04
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
bugs1305832
milestone53.0a1
backs out5b70ccd12b426848e5cb65213d19d078278ec8ba
Backed out changeset 5b70ccd12b42 (bug 1305832) for webgl failures MozReview-Commit-ID: F42Iwt1Rblt
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -2251,18 +2251,16 @@ ZeroTexImageWithClear(WebGLContext* webg
                                  : LOCAL_GL_STENCIL_ATTACHMENT);
         clearBits |= LOCAL_GL_STENCIL_BUFFER_BIT;
     }
 
     MOZ_RELEASE_ASSERT(attachPoint && clearBits, "GFX: No bits cleared.");
 
     {
         gl::GLContext::LocalErrorScope errorScope(*gl);
-        MOZ_ASSERT(target != LOCAL_GL_TEXTURE_2D_ARRAY &&
-                   target != LOCAL_GL_TEXTURE_3D);
         gl->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER, attachPoint, target.get(), tex,
                                   level);
         if (errorScope.GetError()) {
             MOZ_ASSERT(false);
             return false;
         }
     }
 
@@ -2360,22 +2358,28 @@ ZeroTextureData(WebGLContext* webgl, con
             return false;
 
         return true;
     }
 
     const auto driverUnpackInfo = usage->idealUnpack;
     MOZ_RELEASE_ASSERT(driverUnpackInfo, "GFX: ideal unpack info not set.");
 
-    if (!webgl->IsWebGL2() && usage->format->d) {
-        // ANGLE_depth_texture does not allow uploads, so we have to clear.
-        const bool success = ZeroTexImageWithClear(webgl, gl, target, tex, level, usage,
-                                                   width, height);
-        MOZ_ASSERT(success);
-        return success;
+    if (usage->IsRenderable() && depth == 1 &&
+        !xOffset && !yOffset && !zOffset)
+    {
+        // While we would like to skip the extra complexity of trying to zero with an FB
+        // clear, ANGLE_depth_texture requires this.
+        do {
+            if (ZeroTexImageWithClear(webgl, gl, target, tex, level, usage, width,
+                                      height))
+            {
+                return true;
+            }
+        } while (false);
     }
 
     const webgl::PackingInfo packing = driverUnpackInfo->ToPacking();
 
     const auto bytesPerPixel = webgl::BytesPerPixel(packing);
 
     CheckedUint32 checkedByteCount = bytesPerPixel;
     checkedByteCount *= width;