Bug 1461293 - TexStorage needs only one of w,h,d>>(levels-1) to be non-zero. - r=kvark
MozReview-Commit-ID: IUlrfWrLdUc
--- 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);