Bug 1563420 - Don't trigger fb-inval-count warning during resolve. r=lsalzman
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 04 Jul 2019 04:34:45 +0000
changeset 540866 6a2bd09a6bf9aada14581e923408d7308479b76d
parent 540865 41de4f2ef2136f650bf07e070e94a798173b8688
child 540867 ebb510a784b8c1204db1d6a6cc1c5b6ca86e081e
child 540872 89f953aae9214467dd2b3d8ab333686ea525f468
child 540945 f01dbf4e564643fabe35ce553d44ea5b880360ce
push id11529
push userarchaeopteryx@coole-files.de
push dateThu, 04 Jul 2019 15:22:33 +0000
treeherdermozilla-beta@ebb510a784b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1563420
milestone69.0a1
first release with
nightly linux32
6a2bd09a6bf9 / 69.0a1 / 20190704094530 / files
nightly linux64
6a2bd09a6bf9 / 69.0a1 / 20190704094530 / files
nightly mac
6a2bd09a6bf9 / 69.0a1 / 20190704094530 / files
nightly win32
6a2bd09a6bf9 / 69.0a1 / 20190704094530 / files
nightly win64
6a2bd09a6bf9 / 69.0a1 / 20190704094530 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1563420 - Don't trigger fb-inval-count warning during resolve. r=lsalzman Differential Revision: https://phabricator.services.mozilla.com/D36858
dom/canvas/WebGLFramebuffer.cpp
dom/canvas/WebGLFramebuffer.h
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -929,23 +929,24 @@ void WebGLFramebuffer::ResolveAttachment
   }
 
   gl->fClear(clearBits);
 
   RefreshDrawBuffers();
 }
 
 WebGLFramebuffer::CompletenessInfo::~CompletenessInfo() {
-  const auto& fb = this->fb;
+  if (!this->fb) return;
+  const auto& fb = *this->fb;
   const auto& webgl = fb.mContext;
   fb.mNumFBStatusInvals++;
   if (fb.mNumFBStatusInvals > webgl->mMaxAcceptableFBStatusInvals) {
     webgl->GeneratePerfWarning(
         "FB was invalidated after being complete %u"
-        " times.",
+        " times. [webgl.perf.max-acceptable-fb-status-invals]",
         uint32_t(fb.mNumFBStatusInvals));
   }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Entrypoints
 
 FBStatus WebGLFramebuffer::CheckFramebufferStatus() const {
@@ -979,17 +980,17 @@ FBStatus WebGLFramebuffer::CheckFramebuf
                                  ret.get());
       statusInfo = text;
       break;
     }
 
     ResolveAttachmentData();
 
     // Sweet, let's cache that.
-    auto info = CompletenessInfo{*this, UINT32_MAX, UINT32_MAX};
+    auto info = CompletenessInfo{this, UINT32_MAX, UINT32_MAX};
     mCompletenessInfo.ResetInvalidators({});
     mCompletenessInfo.AddInvalidator(*this);
 
     const auto fnIsFloat32 = [](const webgl::FormatInfo& info) {
       if (info.componentType != webgl::ComponentType::Float) return false;
       return info.r == 32;
     };
 
@@ -1008,16 +1009,17 @@ FBStatus WebGLFramebuffer::CheckFramebuf
       MOZ_ASSERT(imageInfo);
       info.width = std::min(info.width, imageInfo->mWidth);
       info.height = std::min(info.height, imageInfo->mHeight);
       info.hasFloat32 |= fnIsFloat32(*imageInfo->mFormat->format);
       info.zLayerCount = cur->ZLayerCount();
       info.isMultiview = cur->IsMultiview();
     }
     mCompletenessInfo = Some(std::move(info));
+    info.fb = nullptr;  // Don't trigger the invalidation warning.
     return LOCAL_GL_FRAMEBUFFER_COMPLETE;
   } while (false);
 
   MOZ_ASSERT(ret != LOCAL_GL_FRAMEBUFFER_COMPLETE);
   mContext->GenerateWarning("Framebuffer not complete. (status: 0x%04x) %s",
                             ret.get(), statusInfo.BeginReading());
   return ret;
 }
--- a/dom/canvas/WebGLFramebuffer.h
+++ b/dom/canvas/WebGLFramebuffer.h
@@ -169,17 +169,17 @@ class WebGLFramebuffer final : public ns
   std::vector<WebGLFBAttachPoint*> mAttachments;  // Non-null.
 
   std::vector<const WebGLFBAttachPoint*> mColorDrawBuffers;  // Non-null
   const WebGLFBAttachPoint* mColorReadBuffer;                // Null if NONE
 
   ////
 
   struct CompletenessInfo final {
-    const WebGLFramebuffer& fb;
+    const WebGLFramebuffer* fb = nullptr;
 
     uint32_t width = 0;
     uint32_t height = 0;
     bool hasFloat32 = false;
     uint8_t zLayerCount = 1;
     bool isMultiview = false;
 
     // IsFeedback