Bug 1310222 - Relax PoT requirement for resource size limits in WebGL. - r=daoshengmu draft
authorJeff Gilbert <jgilbert@mozilla.com>
Mon, 08 May 2017 19:20:37 -0700
changeset 574549 a6793829a20adb633bf054da18bedb4c14f3de2f
parent 574519 b21b974d60d3075ae24f6fb1bae75d0f122f28fc
child 574550 7a8f075d67dae6e2217b9d0b34e47e6b73ec2be9
push id57749
push userbmo:jgilbert@mozilla.com
push dateTue, 09 May 2017 02:24:44 +0000
reviewersdaoshengmu
bugs1310222
milestone55.0a1
Bug 1310222 - Relax PoT requirement for resource size limits in WebGL. - r=daoshengmu MozReview-Commit-ID: 33kGMdPOHkT
dom/canvas/WebGLContextValidate.cpp
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -534,31 +534,16 @@ WebGLContext::InitAndValidateGL(FailureR
             mImplMax3DTextureSize = 0;
         if (!gl->GetPotentialInteger(LOCAL_GL_MAX_ARRAY_TEXTURE_LAYERS, (GLint*)&mImplMaxArrayTextureLayers))
             mImplMaxArrayTextureLayers = 0;
 
         gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS, &mGLMaxTextureImageUnits);
         gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &mGLMaxVertexTextureImageUnits);
     }
 
-    // If we don't support a target, its max size is 0. We should only floor-to-POT if the
-    // value if it's non-zero. (NB log2(0) is -Inf, so zero isn't an integer power-of-two)
-    const auto fnFloorPOTIfSupported = [](uint32_t& val) {
-        if (val) {
-            val = FloorPOT(val);
-        }
-    };
-
-    fnFloorPOTIfSupported(mImplMaxTextureSize);
-    fnFloorPOTIfSupported(mImplMaxCubeMapTextureSize);
-    fnFloorPOTIfSupported(mImplMaxRenderbufferSize);
-
-    fnFloorPOTIfSupported(mImplMax3DTextureSize);
-    fnFloorPOTIfSupported(mImplMaxArrayTextureLayers);
-
     ////////////////
 
     mGLMaxColorAttachments = 1;
     mGLMaxDrawBuffers = 1;
     gl->GetPotentialInteger(LOCAL_GL_MAX_COLOR_ATTACHMENTS,
                             (GLint*)&mGLMaxColorAttachments);
     gl->GetPotentialInteger(LOCAL_GL_MAX_DRAW_BUFFERS, (GLint*)&mGLMaxDrawBuffers);