From 36574af816f877dcd7e1fdf65e5b52e9b360e2f3 Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Mon, 4 Nov 2019 16:47:39 -0700 Subject: [PATCH] ccpr: Fail gracefully when atlas instantiation fails This fixes a crash, but still does not answer the question why 8192x8192 msaa atlas instantiations are failing sporadically on vulkan. Luckily we will be switching to mixed samples soon, so this problem is very temporary. Change-Id: I7dedb3c943f432543c12f02587ece8d71443a1cd Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252646 Reviewed-by: Robert Phillips Commit-Queue: Chris Dalton --- src/gpu/ccpr/GrCCDrawPathsOp.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp index a19f201ddd..c7f756a284 100644 --- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp +++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp @@ -446,15 +446,15 @@ void GrCCDrawPathsOp::onExecute(GrOpFlushState* flushState, const SkRect& chainB SkASSERT(range.fEndInstanceIdx > baseInstance); const GrTextureProxy* atlas = range.fAtlasProxy; - SkASSERT(atlas->isInstantiated()); - - GrCCPathProcessor pathProc( - range.fCoverageMode, atlas->peekTexture(), atlas->textureSwizzle(), atlas->origin(), - fViewMatrixIfUsingLocalCoords); - GrTextureProxy* atlasProxy = range.fAtlasProxy; - fixedDynamicState.fPrimitiveProcessorTextures = &atlasProxy; - pathProc.drawPaths(flushState, pipeline, &fixedDynamicState, *resources, baseInstance, - range.fEndInstanceIdx, this->bounds()); + if (atlas->isInstantiated()) { // Instantiation can fail in exceptional circumstances. + GrCCPathProcessor pathProc(range.fCoverageMode, atlas->peekTexture(), + atlas->textureSwizzle(), atlas->origin(), + fViewMatrixIfUsingLocalCoords); + GrTextureProxy* atlasProxy = range.fAtlasProxy; + fixedDynamicState.fPrimitiveProcessorTextures = &atlasProxy; + pathProc.drawPaths(flushState, pipeline, &fixedDynamicState, *resources, baseInstance, + range.fEndInstanceIdx, this->bounds()); + } baseInstance = range.fEndInstanceIdx; }