Backed out changeset 29c73665ba19 (bug 1478216) for mochitest failure on dom/canvas/test/webgl-conf/generated/test_2_conformance2__rendering__framebuffer-texture-changing-base-level.html
authorDorel Luca <dluca@mozilla.com>
Tue, 23 Oct 2018 03:50:22 +0300
changeset 442459 00049c15c6e5091c2134979250ce31fa9837c81c
parent 442458 9840ad3f518afe551c11dd74f786304e476a707d
child 442460 38e27cc84adc0c40e60e13faac5bdd632591ab4f
push id71510
push userdluca@mozilla.com
push dateTue, 23 Oct 2018 00:52:55 +0000
treeherderautoland@00049c15c6e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1478216
milestone65.0a1
backs out29c73665ba1923bbb91cebfc3f785e8c7471522b
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 29c73665ba19 (bug 1478216) for mochitest failure on dom/canvas/test/webgl-conf/generated/test_2_conformance2__rendering__framebuffer-texture-changing-base-level.html
dom/canvas/WebGLFramebuffer.cpp
dom/canvas/WebGLTexture.cpp
dom/canvas/WebGLTexture.h
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -126,18 +126,17 @@ WebGLFBAttachPoint::IsComplete(WebGLCont
     if (tex) {
         // ES 3.0 spec, pg 213 has giant blocks of text that bake down to requiring that
         // attached tex images are within the valid mip-levels of the texture.
         // While it draws distinction to only test non-immutable textures, that's because
         // immutable textures are *always* texture-complete.
         // We need to check immutable textures though, because checking completeness is
         // also when we zero invalidated/no-data tex images.
         const bool complete = [&]() {
-            const bool ensureInit = false;
-            const auto texCompleteness = tex->CalcCompletenessInfo(ensureInit);
+            const auto texCompleteness = tex->CalcCompletenessInfo();
             if (!texCompleteness) // OOM
                 return false;
             if (!texCompleteness->levels)
                 return false;
 
             const auto baseLevel = tex->BaseMipmapLevel();
             const auto maxLevel = baseLevel + texCompleteness->levels - 1;
             return baseLevel <= mTexImageLevel && mTexImageLevel <= maxLevel;
--- a/dom/canvas/WebGLTexture.cpp
+++ b/dom/canvas/WebGLTexture.cpp
@@ -150,17 +150,17 @@ WebGLTexture::PopulateMipChain(const uin
 
 static bool
 ZeroTextureData(const WebGLContext* webgl, GLuint tex,
                 TexImageTarget target, uint32_t level,
                 const webgl::FormatUsageInfo* usage, uint32_t width, uint32_t height,
                 uint32_t depth);
 
 bool
-WebGLTexture::IsMipAndCubeComplete(const uint32_t maxLevel, const bool ensureInit,
+WebGLTexture::IsMipAndCubeComplete(const uint32_t maxLevel,
                                    bool* const out_initFailed) const
 {
     *out_initFailed = false;
 
     // Reference dimensions based on baseLevel.
     auto ref = BaseImageInfo();
     MOZ_ASSERT(ref.mWidth && ref.mHeight && ref.mDepth);
 
@@ -182,17 +182,17 @@ WebGLTexture::IsMipAndCubeComplete(const
             if (cur.mWidth != ref.mWidth ||
                 cur.mHeight != ref.mHeight ||
                 cur.mDepth != ref.mDepth ||
                 cur.mFormat != ref.mFormat)
             {
                 return false;
             }
 
-            if (MOZ_UNLIKELY( ensureInit && !cur.mHasData )) {
+            if (MOZ_UNLIKELY( !cur.mHasData )) {
                 auto imageTarget = mTarget.get();
                 if (imageTarget == LOCAL_GL_TEXTURE_CUBE_MAP) {
                     imageTarget = LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
                 }
                 if (!ZeroTextureData(mContext, mGLName, imageTarget, level,
                                      cur.mFormat, cur.mWidth, cur.mHeight, cur.mDepth))
                 {
                     mContext->ErrorOutOfMemory("Failed to zero tex image data.");
@@ -208,17 +208,17 @@ WebGLTexture::IsMipAndCubeComplete(const
             break;
         ref = next.ref();
     }
 
     return true;
 }
 
 Maybe<const WebGLTexture::CompletenessInfo>
-WebGLTexture::CalcCompletenessInfo(const bool ensureInit, const bool skipMips) const
+WebGLTexture::CalcCompletenessInfo() const
 {
     Maybe<CompletenessInfo> ret = Some(CompletenessInfo());
 
     // -
 
     if (mBaseMipmapLevel > kMaxLevelCount - 1) {
         ret->incompleteReason = "`level_base` too high.";
         return ret;
@@ -238,17 +238,17 @@ WebGLTexture::CalcCompletenessInfo(const
 
     if (!baseImageInfo.mWidth || !baseImageInfo.mHeight || !baseImageInfo.mDepth) {
         ret->incompleteReason = "The dimensions of `level_base` are not all positive.";
         return ret;
     }
 
     // "* The texture is a cube map texture, and is not cube complete."
     bool initFailed = false;
-    if (!IsMipAndCubeComplete(mBaseMipmapLevel, ensureInit, &initFailed)) {
+    if (!IsMipAndCubeComplete(mBaseMipmapLevel, &initFailed)) {
         if (initFailed)
             return {};
 
         // Can only fail if not cube-complete.
         ret->incompleteReason = "Cubemaps must be \"cube complete\".";
         return ret;
     }
     ret->levels = 1;
@@ -274,20 +274,17 @@ WebGLTexture::CalcCompletenessInfo(const
     // "* `level_base <= level_max`"
 
     const auto maxLevel = EffectiveMaxLevel();
     if (mBaseMipmapLevel > maxLevel) {
         ret->incompleteReason = "`level_base > level_max`.";
         return ret;
     }
 
-    if (skipMips)
-        return ret;
-
-    if (!IsMipAndCubeComplete(maxLevel, ensureInit, &initFailed)) {
+    if (!IsMipAndCubeComplete(maxLevel, &initFailed)) {
         if (initFailed)
             return {};
 
         ret->incompleteReason = "Bad mipmap dimension or format.";
         return ret;
     }
     ret->levels = maxLevel - mBaseMipmapLevel + 1;
     ret->mipmapComplete = true;
@@ -297,18 +294,17 @@ WebGLTexture::CalcCompletenessInfo(const
     return ret;
 }
 
 Maybe<const webgl::SampleableInfo>
 WebGLTexture::CalcSampleableInfo(const WebGLSampler* const sampler) const
 {
     Maybe<webgl::SampleableInfo> ret = Some(webgl::SampleableInfo());
 
-    const bool ensureInit = true;
-    const auto completeness = CalcCompletenessInfo(ensureInit);
+    const auto completeness = CalcCompletenessInfo();
     if (!completeness)
         return {};
 
     ret->incompleteReason = completeness->incompleteReason;
 
     if (!completeness->levels)
         return ret;
 
@@ -576,19 +572,18 @@ ZeroTextureData(const WebGLContext* webg
     // 1. Lazy zeroing of uninitialized textures:
     //    a. Before draw.
     //    b. Before partial upload. (TexStorage + TexSubImage)
     // 2. Zero subrects from out-of-bounds blits. (CopyTex(Sub)Image)
 
     // We have no sympathy for any of these cases.
 
     // "Doctor, it hurts when I do this!" "Well don't do that!"
-    const auto targetStr = EnumString(target.get());
-    webgl->GeneratePerfWarning("Tex image %s level %u is incurring lazy initialization.",
-                               targetStr.c_str(), level);
+    webgl->GenerateWarning("This operation requires zeroing texture data. This is"
+                           " slow.");
 
     gl::GLContext* gl = webgl->GL();
 
     GLenum scopeBindTarget;
     switch (target.get()) {
     case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
     case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
     case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
@@ -737,20 +732,17 @@ WebGLTexture::BindTexture(TexTarget texT
 void
 WebGLTexture::GenerateMipmap()
 {
     // GLES 3.0.4 p160:
     // "Mipmap generation replaces texel array levels level base + 1 through q with arrays
     //  derived from the level base array, regardless of their previous contents. All
     //  other mipmap arrays, including the level base array, are left unchanged by this
     //  computation."
-    // But only check and init the base level.
-    const bool ensureInit = true;
-    const bool skipMips = true;
-    const auto completeness = CalcCompletenessInfo(ensureInit, skipMips);
+    const auto completeness = CalcCompletenessInfo();
     if (!completeness || !completeness->levels) {
         mContext->ErrorInvalidOperation("The texture's base level must be complete.");
         return;
     }
     const auto& usage = completeness->usage;
     const auto& format = usage->format;
     if (!mContext->IsWebGL2()) {
         if (!completeness->powerOfTwo) {
--- a/dom/canvas/WebGLTexture.h
+++ b/dom/canvas/WebGLTexture.h
@@ -140,18 +140,17 @@ protected:
         bool mipmapComplete = false;
         const webgl::FormatUsageInfo* usage = nullptr;
         const char* incompleteReason = nullptr;
     };
 
     mutable CacheWeakMap<const WebGLSampler*, webgl::SampleableInfo> mSamplingCache;
 
 public:
-    Maybe<const CompletenessInfo> CalcCompletenessInfo(bool ensureInit,
-                                                       bool skipMips = false) const;
+    Maybe<const CompletenessInfo> CalcCompletenessInfo() const;
     Maybe<const webgl::SampleableInfo> CalcSampleableInfo(const WebGLSampler*) const;
 
     const webgl::SampleableInfo* GetSampleableInfo(const WebGLSampler*) const;
 
 
     // -
 
     const auto& Immutable() const { return mImmutable; }
@@ -306,18 +305,17 @@ public:
         return ImageInfoAtFace(0, mBaseMipmapLevel);
     }
 
     size_t MemoryUsage() const;
 
     bool EnsureImageDataInitialized(TexImageTarget target,
                                     uint32_t level);
     void PopulateMipChain(uint32_t maxLevel);
-    bool IsMipAndCubeComplete(uint32_t maxLevel, bool ensureInit,
-                              bool* out_initFailed) const;
+    bool IsMipAndCubeComplete(uint32_t maxLevel, bool* out_initFailed) const;
 
     bool IsCubeMap() const { return (mTarget == LOCAL_GL_TEXTURE_CUBE_MAP); }
 };
 
 inline TexImageTarget
 TexImageTargetForTargetAndFace(TexTarget target, uint8_t face)
 {
     switch (target.get()) {