Add GrOp::wasRecorded and use in instanced rendering for tracking.

BUG=skia:

Change-Id: I4c5cdf47d42b7adae3649c7f96caabe68f45acbf
Reviewed-on: https://skia-review.googlesource.com/9308
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Brian Salomon 2017-03-06 16:36:49 -05:00 committed by Skia Commit-Bot
parent e9ed07de16
commit d543e0a835
4 changed files with 15 additions and 0 deletions

View File

@ -274,6 +274,7 @@ GrOp* GrRenderTargetOpList::recordOp(std::unique_ptr<GrOp> 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();

View File

@ -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;
}

View File

@ -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);

View File

@ -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.