Don't attempt to use stencil on wrapped, stencil-less targets
We can't attach stencil to a wrapped render target. If we find
ourselves rendering to one that doesn't have stencil already, don't
issue any ops that use stencil.
Bug: chromium:1196353
Bug: skia:11943
Change-Id: I9db93f31a4f8556103be72eb708755e4eaf78136
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399839
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index 862f151..20f97cc 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -574,6 +574,7 @@
GrAttachment* stencil = nullptr;
if (proxy->needsStencil()) {
+ SkASSERT(proxy->canUseStencil(caps));
if (!flushState->resourceProvider()->attachStencilAttachment(renderTarget,
fUsesMSAASurface)) {
SkDebugf("WARNING: failed to attach a stencil buffer. Rendering will be skipped.\n");