diff --git a/src/gpu/graphite/DrawList.cpp b/src/gpu/graphite/DrawList.cpp index 3d3d016f228..6be64404c41 100644 --- a/src/gpu/graphite/DrawList.cpp +++ b/src/gpu/graphite/DrawList.cpp @@ -222,6 +222,10 @@ std::unique_ptr DrawList::snapDrawPass(Recorder* recorder, if (bufferMgr->hasMappingFailed()) { SKGPU_LOG_W("Failed to write necessary vertex/instance data for DrawPass, dropping!"); + // The persistent fUniformDataCache holds raw Buffer* pointers whose + // owning sk_sp<> were already dropped by onFailedBuffer(); reset + // before returning so they cannot be reused on the next snap. + this->reset(LoadOp::kLoad); return nullptr; } diff --git a/src/gpu/graphite/DrawListLayer.cpp b/src/gpu/graphite/DrawListLayer.cpp index ef0f629945c..69381f988a9 100644 --- a/src/gpu/graphite/DrawListLayer.cpp +++ b/src/gpu/graphite/DrawListLayer.cpp @@ -505,6 +505,9 @@ std::unique_ptr DrawListLayer::snapDrawPass(Recorder* recorder, list->fStep, *current->fDrawParams, false)) { + // See DrawList::snapDrawPass: fUniformDataCache holds dangling + // raw Buffer* after onFailedBuffer(); reset before returning. + this->reset(LoadOp::kLoad); return nullptr; } current = current->fNext; @@ -515,6 +518,7 @@ std::unique_ptr DrawListLayer::snapDrawPass(Recorder* recorder, list->fStep, *current->fDrawParams, true)) { + this->reset(LoadOp::kLoad); return nullptr; } current = current->fNext;