Skip addInterval for stencil proxies ignored by resource allocator

Bug: skia:
Change-Id: Ie2790e3fb3d0d34d7f971a24af1ff81c4ef680cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220836
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Chris Dalton 2019-06-13 13:40:20 -06:00 committed by Skia Commit-Bot
parent f0e7581d94
commit 9715559684

View File

@ -79,11 +79,15 @@ void GrResourceAllocator::addInterval(GrSurfaceProxy* proxy, unsigned int start,
? proxy->asRenderTargetProxy()->needsStencil()
: false;
// If we're going to need to add a stencil buffer in assign, we
// need to add at least a symbolic interval
// TODO: adding this interval just to add a stencil buffer is
// a bit heavy weight. Is there a simpler way to accomplish this?
if (!needsStencil && proxy->canSkipResourceAllocator()) {
if (proxy->canSkipResourceAllocator()) {
if (needsStencil && proxy->isInstantiated()) {
// If the proxy is still not instantiated at this point but will need stencil, it will
// attach its own stencil buffer upon onFlush instantiation.
if (!GrSurfaceProxyPriv::AttachStencilIfNeeded(
fResourceProvider, proxy->peekSurface(), true /*needsStencil*/)) {
SkDebugf("WARNING: failed to attach stencil buffer. Rendering may be incorrect.\n");
}
}
return;
}