diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index 1826689ef3..1c9835389e 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -274,6 +274,7 @@ GrOp* GrRenderTargetOpList::recordOp(std::unique_ptr op, } GR_AUDIT_TRAIL_OP_RESULT_NEW(fAuditTrail, op); fRecordedOps.emplace_back(std::move(op), renderTarget); + fRecordedOps.back().fOp->wasRecorded(); fLastFullClearOp = nullptr; fLastFullClearRenderTargetID.makeInvalid(); return fRecordedOps.back().fOp.get(); diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp index 1ffaaa44d4..ef2264b0ef 100644 --- a/src/gpu/instanced/InstancedRendering.cpp +++ b/src/gpu/instanced/InstancedRendering.cpp @@ -369,7 +369,10 @@ void InstancedRendering::Op::applyPipelineOptimizations( } fInfo.fUsesLocalCoords = optimizations.readsLocalCoords(); fInfo.fCannotTweakAlphaForCoverage = !optimizations.canTweakAlphaForCoverage(); +} +void InstancedRendering::Op::wasRecorded() { + SkASSERT(!fIsTracked); fInstancedRendering->fTrackedOps.addToTail(this); fIsTracked = true; } diff --git a/src/gpu/instanced/InstancedRendering.h b/src/gpu/instanced/InstancedRendering.h index 8002d5046b..778e8b4511 100644 --- a/src/gpu/instanced/InstancedRendering.h +++ b/src/gpu/instanced/InstancedRendering.h @@ -141,6 +141,9 @@ protected: void appendParamsTexel(SkScalar x, SkScalar y, SkScalar z, SkScalar w); void appendParamsTexel(SkScalar x, SkScalar y, SkScalar z); + // Registers the op with the InstancedRendering list of tracked ops. + void wasRecorded() override; + protected: Op(uint32_t classID, InstancedRendering* ir); diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h index 11198dd9d7..c1bf7f7555 100644 --- a/src/gpu/ops/GrOp.h +++ b/src/gpu/ops/GrOp.h @@ -125,6 +125,14 @@ public: return fUniqueID; } + /** + * This is called to notify the op that it has been recorded into a GrOpList. Ops can use this + * to begin preparations for the flush of the op list. Note that the op still may either be + * combined into another op or have another op combined into it via combineIfPossible() after + * this call is made. + */ + virtual void wasRecorded() {} + /** * Called prior to executing. The op should perform any resource creation or data transfers * necessary before execute() is called.