Guard against FramebufferStatus checks in GrGLRenderTarget
authorrobertphillips <robertphillips@google.com>
Thu, 21 Apr 2016 18:27:43 +0000 (11:27 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 21 Apr 2016 18:27:43 +0000 (11:27 -0700)
BUG=skia:5200

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1905063002

Review URL: https://codereview.chromium.org/1905063002

src/gpu/gl/GrGLRenderTarget.cpp

index d4585f6402f926441d3893b632c1c1ebcaafe005..b77ec4b44740e18b63ac5cf209d03303175ced69 100644 (file)
@@ -84,9 +84,13 @@ bool GrGLRenderTarget::completeStencilAttachment() {
                                                       GR_GL_DEPTH_ATTACHMENT,
                                                       GR_GL_RENDERBUFFER, 0));
 #ifdef SK_DEBUG
-        GrGLenum status;
-        GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
-        SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status);
+        if (kChromium_GrGLDriver != gpu->glContext().driver()) {
+            // This check can cause problems in Chromium if the context has been asynchronously
+            // abandoned (see skbug.com/5200)
+            GrGLenum status;
+            GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
+            SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status);
+        }
 #endif
         return true;
     } else {
@@ -110,9 +114,13 @@ bool GrGLRenderTarget::completeStencilAttachment() {
         }
 
 #ifdef SK_DEBUG
-        GrGLenum status;
-        GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
-        SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status);
+        if (kChromium_GrGLDriver != gpu->glContext().driver()) {
+            // This check can cause problems in Chromium if the context has been asynchronously
+            // abandoned (see skbug.com/5200)
+            GrGLenum status;
+            GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
+            SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status);
+        }
 #endif
         return true;
     }