diff options
author | Robert Phillips <robertphillips@google.com> | 2016-11-17 10:22:48 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-17 17:34:13 +0000 |
commit | e60ad620fe236ce4c1e85a31bd53ed0c848da8c3 (patch) | |
tree | 99293fa57aeb9cf3887764c3ec2e8096421f6703 /src/gpu/GrRenderTargetOpList.cpp | |
parent | 987de5b6b996ab19aac8e09fa030bbb35ed51a3b (diff) |
Guard against instantiate & accessRenderTarget failures
Chrome's fuzzer have reminded me that, since we are deferring allocation, instantiate and accessRenderTarget can now fail further down the call stack.
This should probably be cherry picked back to M56.
BUG=665681,665500,665621
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4929
Change-Id: I44d81ff29586dfe75ddda30b5ed8ca76354542d6
Reviewed-on: https://skia-review.googlesource.com/4929
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetOpList.cpp')
-rw-r--r-- | src/gpu/GrRenderTargetOpList.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index 72a29ab8cd..aab71f9019 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -301,6 +301,10 @@ void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder, } if (pipelineBuilder.hasUserStencilSettings() || appliedClip.hasStencilClip()) { + if (!renderTargetContext->accessRenderTarget()) { + return; + } + if (!fResourceProvider->attachStencilAttachment( renderTargetContext->accessRenderTarget())) { SkDebugf("ERROR creating stencil attachment. Draw skipped.\n"); @@ -341,6 +345,10 @@ void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder, args.fScissor = &appliedClip.scissorState(); args.fWindowRectsState = &appliedClip.windowRectsState(); args.fHasStencilClip = appliedClip.hasStencilClip(); + if (!renderTargetContext->accessRenderTarget()) { + return; + } + if (!this->setupDstReadIfNecessary(pipelineBuilder, renderTargetContext->accessRenderTarget(), clip, args.fOpts, &args.fDstTexture, batch->bounds())) { @@ -382,6 +390,9 @@ void GrRenderTargetOpList::stencilPath(GrRenderTargetContext* renderTargetContex // attempt this in a situation that would require coverage AA. SkASSERT(!appliedClip.clipCoverageFragmentProcessor()); + if (!renderTargetContext->accessRenderTarget()) { + return; + } GrStencilAttachment* stencilAttachment = fResourceProvider->attachStencilAttachment( renderTargetContext->accessRenderTarget()); if (!stencilAttachment) { |