Bug 1461293 - TexStorage needs only one of w,h,d>>(levels-1) to be non-zero. - r=kvark draft
authorJeff Gilbert <jgilbert@mozilla.com>
Tue, 15 May 2018 17:00:31 -0700
changeset 795555 6bb76b128f9fb63cddaecb00c65f512e0d631bec
parent 795256 cf3ee14023483cbbb57129479537c713e22c1980
push id110008
push userbmo:jgilbert@mozilla.com
push dateWed, 16 May 2018 00:52:52 +0000
reviewerskvark
bugs1461293
milestone62.0a1
Bug 1461293 - TexStorage needs only one of w,h,d>>(levels-1) to be non-zero. - r=kvark MozReview-Commit-ID: IUlrfWrLdUc
dom/canvas/WebGLTextureUpload.cpp
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -1141,20 +1141,20 @@ WebGLTexture::TexStorage(const char* fun
         const auto lastLevel = uint32_t(levels - 1);
         if (lastLevel > 31)
             return false;
 
         const auto lastLevelWidth = uint32_t(width) >> lastLevel;
         const auto lastLevelHeight = uint32_t(height) >> lastLevel;
 
         // If these are all zero, then some earlier level was the final 1x1(x1) level.
-        bool ok = lastLevelWidth && lastLevelHeight;
+        bool ok = lastLevelWidth || lastLevelHeight;
         if (target == LOCAL_GL_TEXTURE_3D) {
             const auto lastLevelDepth = uint32_t(depth) >> lastLevel;
-            ok &= bool(lastLevelDepth);
+            ok |= bool(lastLevelDepth);
         }
         return ok;
     }();
     if (!levelsOk) {
         mContext->ErrorInvalidOperation("%s: Too many levels requested for the given"
                                         " dimensions. (levels: %u, width: %u, height: %u,"
                                         " depth: %u)",
                                         funcName, levels, width, height, depth);