Bug 1427668 - InvalidateFB should accept incomplete FBs, but just skip them for now. - r=daoshengmu
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 20 Dec 2017 12:16:43 -0800
changeset 449839 94193e9d22f3e9a0a4d6dc40957934dacf32b335
parent 449838 2b126d984d82606c50f9ee97d785d31f7666b5bc
child 449840 19c6be93dcad05673d0ff44fedf7192109b6aabd
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaoshengmu
bugs1427668
milestone59.0a1
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
Bug 1427668 - InvalidateFB should accept incomplete FBs, but just skip them for now. - r=daoshengmu MozReview-Commit-ID: LZtVwzZ1HK8
dom/canvas/WebGL2ContextFramebuffers.cpp
--- a/dom/canvas/WebGL2ContextFramebuffers.cpp
+++ b/dom/canvas/WebGL2ContextFramebuffers.cpp
@@ -169,18 +169,24 @@ WebGLContext::ValidateInvalidateFramebuf
     case LOCAL_GL_READ_FRAMEBUFFER:
         fb = mBoundReadFramebuffer;
         break;
 
     default:
         MOZ_CRASH("GFX: Bad target.");
     }
 
-    if (!ValidateAndInitFB(funcName, fb))
-        return false;
+    if (fb) {
+        const auto fbStatus = fb->CheckFramebufferStatus(funcName);
+        if (fbStatus != LOCAL_GL_FRAMEBUFFER_COMPLETE)
+            return false; // Not an error, but don't run forward to driver either.
+    } else {
+        if (!EnsureDefaultFB())
+            return false;
+    }
     DoBindFB(fb, target);
 
     *out_glNumAttachments = attachments.Length();
     *out_glAttachments = attachments.Elements();
 
     if (fb) {
         for (const auto& attachment : attachments) {
             if (!ValidateFramebufferAttachmentEnum(this, funcName, attachment))