Return GrProcessorSet::Analysis from GrDrawOp::finalize
Bug: skia:8671 Change-Id: Ib35d1642659021419f408bf19b1b0dc0066e8df2 Reviewed-on: https://skia-review.googlesource.com/c/184160 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
parent
61a16515cf
commit
4b62aed973
@ -151,8 +151,8 @@ public:
|
||||
return FixedFunctionFlags::kNone;
|
||||
}
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -28,10 +28,9 @@ class BezierTestOp : public GrMeshDrawOp {
|
||||
public:
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
auto analysis = fProcessorSet.finalize(fColor, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
clip, false, caps, &fColor);
|
||||
return analysis.requiresDstTexture() ? RequiresDstTexture::kYes : RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fProcessorSet.finalize(fColor, GrProcessorAnalysisCoverage::kSingleChannel, clip,
|
||||
false, caps, &fColor);
|
||||
}
|
||||
|
||||
void visitProxies(const VisitProxyFunc& func, VisitorType) const override {
|
||||
|
@ -104,8 +104,8 @@ private:
|
||||
|
||||
const char* name() const override { return "ClockwiseTestOp"; }
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||
|
@ -57,10 +57,9 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
auto analysis = fProcessors.finalize(fColor, GrProcessorAnalysisCoverage::kNone, clip,
|
||||
false, caps, &fColor);
|
||||
return analysis.requiresDstTexture() ? RequiresDstTexture::kYes : RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fProcessors.finalize(fColor, GrProcessorAnalysisCoverage::kNone, clip, false, caps,
|
||||
&fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -129,8 +129,8 @@ private:
|
||||
|
||||
const char* name() const override { return "ClockwiseTestOp"; }
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||
|
@ -90,8 +90,8 @@ public:
|
||||
|
||||
private:
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
|
||||
|
@ -1912,7 +1912,8 @@ void GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<GrDraw
|
||||
}
|
||||
|
||||
GrXferProcessor::DstProxy dstProxy;
|
||||
if (GrDrawOp::RequiresDstTexture::kYes == op->finalize(*this->caps(), &appliedClip)) {
|
||||
GrProcessorSet::Analysis processorAnalysis = op->finalize(*this->caps(), &appliedClip);
|
||||
if (processorAnalysis.requiresDstTexture()) {
|
||||
if (!this->setupDstProxy(this->asRenderTargetProxy(), clip, *op, &dstProxy)) {
|
||||
fContext->contextPriv().opMemoryPool()->release(std::move(op));
|
||||
return;
|
||||
|
@ -138,13 +138,12 @@ GrCCDrawPathsOp::SingleDraw::SingleDraw(const SkMatrix& m, const GrShape& shape,
|
||||
#endif
|
||||
}
|
||||
|
||||
GrDrawOp::RequiresDstTexture GrCCDrawPathsOp::finalize(const GrCaps& caps,
|
||||
const GrAppliedClip* clip) {
|
||||
GrProcessorSet::Analysis GrCCDrawPathsOp::finalize(const GrCaps& caps, const GrAppliedClip* clip) {
|
||||
SkASSERT(1 == fNumDraws); // There should only be one single path draw in this Op right now.
|
||||
return fDraws.head().finalize(caps, clip, &fProcessors);
|
||||
}
|
||||
|
||||
GrDrawOp::RequiresDstTexture GrCCDrawPathsOp::SingleDraw::finalize(
|
||||
GrProcessorSet::Analysis GrCCDrawPathsOp::SingleDraw::finalize(
|
||||
const GrCaps& caps, const GrAppliedClip* clip, GrProcessorSet* processors) {
|
||||
const GrProcessorSet::Analysis& analysis = processors->finalize(
|
||||
fColor, GrProcessorAnalysisCoverage::kSingleChannel, clip, false, caps,
|
||||
@ -178,7 +177,7 @@ GrDrawOp::RequiresDstTexture GrCCDrawPathsOp::SingleDraw::finalize(
|
||||
fColor = fColor * coverage;
|
||||
}
|
||||
|
||||
return RequiresDstTexture(analysis.requiresDstTexture());
|
||||
return analysis;
|
||||
}
|
||||
|
||||
GrOp::CombineResult GrCCDrawPathsOp::onCombineIfPossible(GrOp* op, const GrCaps&) {
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
const char* name() const override { return "GrCCDrawPathsOp"; }
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override;
|
||||
CombineResult onCombineIfPossible(GrOp*, const GrCaps&) override;
|
||||
void visitProxies(const VisitProxyFunc& fn, VisitorType) const override {
|
||||
fProcessors.visitProxies(fn);
|
||||
@ -89,7 +89,7 @@ private:
|
||||
const SkPMColor4f&);
|
||||
|
||||
// See the corresponding methods in GrCCDrawPathsOp.
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*, GrProcessorSet*);
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*, GrProcessorSet*);
|
||||
void accountForOwnPath(GrCCPathCache*, GrOnFlushResourceProvider*,
|
||||
GrCCPerFlushResourceSpecs*);
|
||||
void setupResources(GrCCPathCache*, GrOnFlushResourceProvider*, GrCCPerFlushResources*,
|
||||
|
@ -29,8 +29,8 @@ namespace {
|
||||
class AtlasOp : public GrDrawOp {
|
||||
public:
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
CombineResult onCombineIfPossible(GrOp* other, const GrCaps&) override {
|
||||
// We will only make multiple copy ops if they have different source proxies.
|
||||
|
@ -707,9 +707,9 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fPaths.back().fColor);
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fPaths.back().fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -79,8 +79,7 @@ GrAAFillRRectOp::GrAAFillRRectOp(const GrShaderCaps& shaderCaps, const SkMatrix&
|
||||
// We will write the color and local rect attribs during finalize().
|
||||
}
|
||||
|
||||
GrDrawOp::RequiresDstTexture GrAAFillRRectOp::finalize(const GrCaps& caps,
|
||||
const GrAppliedClip* clip) {
|
||||
GrProcessorSet::Analysis GrAAFillRRectOp::finalize(const GrCaps& caps, const GrAppliedClip* clip) {
|
||||
SkASSERT(1 == fInstanceCount);
|
||||
|
||||
SkPMColor4f overrideColor;
|
||||
@ -97,7 +96,7 @@ GrDrawOp::RequiresDstTexture GrAAFillRRectOp::finalize(const GrCaps& caps,
|
||||
}
|
||||
fInstanceStride = fInstanceData.count();
|
||||
|
||||
return RequiresDstTexture(analysis.requiresDstTexture());
|
||||
return analysis;
|
||||
}
|
||||
|
||||
GrDrawOp::CombineResult GrAAFillRRectOp::onCombineIfPossible(GrOp* op, const GrCaps&) {
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
const char* name() const override { return "GrAAFillRRectOp"; }
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override;
|
||||
CombineResult onCombineIfPossible(GrOp*, const GrCaps&) override;
|
||||
void visitProxies(const VisitProxyFunc& fn, VisitorType) const override {
|
||||
fProcessors.visitProxies(fn);
|
||||
|
@ -839,9 +839,9 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fColor);
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -187,9 +187,9 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fPaths.back().fColor);
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fPaths.back().fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -140,8 +140,7 @@ GrDrawOp::FixedFunctionFlags GrAtlasTextOp::fixedFunctionFlags() const {
|
||||
return FixedFunctionFlags::kNone;
|
||||
}
|
||||
|
||||
GrDrawOp::RequiresDstTexture GrAtlasTextOp::finalize(const GrCaps& caps,
|
||||
const GrAppliedClip* clip) {
|
||||
GrProcessorSet::Analysis GrAtlasTextOp::finalize(const GrCaps& caps, const GrAppliedClip* clip) {
|
||||
GrProcessorAnalysisCoverage coverage;
|
||||
GrProcessorAnalysisColor color;
|
||||
if (kColorBitmapMask_MaskType == fMaskType) {
|
||||
@ -169,7 +168,7 @@ GrDrawOp::RequiresDstTexture GrAtlasTextOp::finalize(const GrCaps& caps,
|
||||
fCanCombineOnTouchOrOverlap =
|
||||
!analysis.requiresDstTexture() &&
|
||||
!(fProcessors.xferProcessor() && fProcessors.xferProcessor()->xferBarrierType(caps));
|
||||
return analysis.requiresDstTexture() ? RequiresDstTexture::kYes : RequiresDstTexture::kNo;
|
||||
return analysis;
|
||||
}
|
||||
|
||||
static void clip_quads(const SkIRect& clipRect, char* currVertex, const char* blobVertices,
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override;
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
|
||||
|
||||
enum MaskType {
|
||||
kGrayscaleCoverageMask_MaskType,
|
||||
|
@ -257,7 +257,7 @@ public:
|
||||
return flags;
|
||||
}
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorAnalysisCoverage coverage;
|
||||
if (AAMode::kNone == fAAMode && !clip->numClipCoverageFragmentProcessors()) {
|
||||
coverage = GrProcessorAnalysisCoverage::kNone;
|
||||
@ -269,7 +269,7 @@ public:
|
||||
(fProcessorSet.xferProcessor() &&
|
||||
fProcessorSet.xferProcessor()->xferBarrierType(caps));
|
||||
fUsesLocalCoords = analysis.usesLocalCoords();
|
||||
return analysis.requiresDstTexture() ? RequiresDstTexture::kYes : RequiresDstTexture::kNo;
|
||||
return analysis;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -392,11 +392,11 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorAnalysisCoverage gpCoverage =
|
||||
this->coverage() == 0xFF ? GrProcessorAnalysisCoverage::kNone
|
||||
: GrProcessorAnalysisCoverage::kSingleChannel;
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, gpCoverage, &fColor);
|
||||
return fHelper.finalizeProcessors(caps, clip, gpCoverage, &fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -182,16 +182,15 @@ GrDrawOp::FixedFunctionFlags GrDrawAtlasOp::fixedFunctionFlags() const {
|
||||
return fHelper.fixedFunctionFlags();
|
||||
}
|
||||
|
||||
GrDrawOp::RequiresDstTexture GrDrawAtlasOp::finalize(const GrCaps& caps,
|
||||
const GrAppliedClip* clip) {
|
||||
GrProcessorSet::Analysis GrDrawAtlasOp::finalize(const GrCaps& caps, const GrAppliedClip* clip) {
|
||||
GrProcessorAnalysisColor gpColor;
|
||||
if (this->hasColors()) {
|
||||
gpColor.setToUnknown();
|
||||
} else {
|
||||
gpColor.setToConstant(fColor);
|
||||
}
|
||||
auto result = fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
|
||||
&gpColor);
|
||||
auto result = fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kNone,
|
||||
&gpColor);
|
||||
if (gpColor.isConstant(&fColor)) {
|
||||
fHasColors = false;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override;
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
|
||||
|
||||
private:
|
||||
void onPrepareDraws(Target*) override;
|
||||
|
@ -36,7 +36,6 @@ public:
|
||||
GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(FixedFunctionFlags);
|
||||
virtual FixedFunctionFlags fixedFunctionFlags() const = 0;
|
||||
|
||||
enum class RequiresDstTexture : bool { kNo = false, kYes = true };
|
||||
/**
|
||||
* This is called after the GrAppliedClip has been computed and just prior to recording the op
|
||||
* or combining it with a previously recorded op. The op should convert any proxies or resources
|
||||
@ -44,7 +43,7 @@ public:
|
||||
* at this time the op must report whether a copy of the destination (or destination texture
|
||||
* itself) needs to be provided to the GrXferProcessor when this op executes.
|
||||
*/
|
||||
virtual RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) = 0;
|
||||
virtual GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) = 0;
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
bool fAddDrawOpCalled = false;
|
||||
|
@ -29,9 +29,8 @@ protected:
|
||||
}
|
||||
return FixedFunctionFlags::kUsesStencil;
|
||||
}
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return this->doProcessorAnalysis(caps, clip).requiresDstTexture()
|
||||
? RequiresDstTexture::kYes : RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return this->doProcessorAnalysis(caps, clip);
|
||||
}
|
||||
|
||||
void visitProxies(const VisitProxyFunc& func, VisitorType) const override {
|
||||
|
@ -129,16 +129,15 @@ GrDrawOp::FixedFunctionFlags GrDrawVerticesOp::fixedFunctionFlags() const {
|
||||
return fHelper.fixedFunctionFlags();
|
||||
}
|
||||
|
||||
GrDrawOp::RequiresDstTexture GrDrawVerticesOp::finalize(const GrCaps& caps,
|
||||
const GrAppliedClip* clip) {
|
||||
GrProcessorSet::Analysis GrDrawVerticesOp::finalize(const GrCaps& caps, const GrAppliedClip* clip) {
|
||||
GrProcessorAnalysisColor gpColor;
|
||||
if (this->requiresPerVertexColors()) {
|
||||
gpColor.setToUnknown();
|
||||
} else {
|
||||
gpColor.setToConstant(fMeshes.front().fColor);
|
||||
}
|
||||
auto result = fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
|
||||
&gpColor);
|
||||
auto result = fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kNone,
|
||||
&gpColor);
|
||||
if (gpColor.isConstant(&fMeshes.front().fColor)) {
|
||||
fMeshes.front().fIgnoreColors = true;
|
||||
fFlags &= ~kRequiresPerVertexColors_Flag;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override;
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
|
||||
|
||||
private:
|
||||
enum class ColorArrayType {
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
// Initialize aggregate color analysis with the first quad's color (which always exists)
|
||||
SkASSERT(this->quadCount() > 0);
|
||||
GrProcessorAnalysisColor quadColors(fDeviceQuads.metadata(0).fColor);
|
||||
@ -141,7 +141,7 @@ public:
|
||||
GrProcessorAnalysisCoverage coverage = fHelper.aaType() == GrAAType::kCoverage ?
|
||||
GrProcessorAnalysisCoverage::kSingleChannel :
|
||||
GrProcessorAnalysisCoverage::kNone;
|
||||
auto result = fHelper.xpRequiresDstTexture(caps, clip, coverage, &quadColors);
|
||||
auto result = fHelper.finalizeProcessors(caps, clip, coverage, &quadColors);
|
||||
// If there is a constant color after analysis, that means all of the quads should be set
|
||||
// to the same color (even if they started out with different colors).
|
||||
SkPMColor4f colorOverride;
|
||||
|
@ -193,12 +193,12 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
auto opaque = fPatches[0].fColor.isOpaque() && GrPixelConfigIsOpaque(fProxy->config())
|
||||
? GrProcessorAnalysisColor::Opaque::kYes
|
||||
: GrProcessorAnalysisColor::Opaque::kNo;
|
||||
auto analysisColor = GrProcessorAnalysisColor(opaque);
|
||||
auto result = fHelper.xpRequiresDstTexture(
|
||||
auto result = fHelper.finalizeProcessors(
|
||||
caps, clip, GrProcessorAnalysisCoverage::kNone, &analysisColor);
|
||||
analysisColor.isConstant(&fPatches[0].fColor);
|
||||
return result;
|
||||
|
@ -1146,10 +1146,10 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
SkPMColor4f* color = &fCircles.front().fColor;
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
}
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
@ -1472,10 +1472,10 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
SkPMColor4f* color = &fCircles.front().fColor;
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
}
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
@ -1751,10 +1751,10 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
SkPMColor4f* color = &fEllipses.front().fColor;
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
}
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
@ -1972,10 +1972,10 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
SkPMColor4f* color = &fEllipses.front().fColor;
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
}
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
@ -2287,10 +2287,10 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
SkPMColor4f* color = &fRRects.front().fColor;
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
}
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
@ -2622,10 +2622,10 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
SkPMColor4f* color = &fRRects.front().fColor;
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
color);
|
||||
}
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
@ -86,9 +86,9 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
|
||||
&fRegions[0].fColor);
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kNone,
|
||||
&fRegions[0].fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -255,8 +255,8 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -69,7 +69,7 @@ bool GrSimpleMeshDrawOpHelper::isCompatible(const GrSimpleMeshDrawOpHelper& that
|
||||
return result;
|
||||
}
|
||||
|
||||
GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture(
|
||||
GrProcessorSet::Analysis GrSimpleMeshDrawOpHelper::finalizeProcessors(
|
||||
const GrCaps& caps, const GrAppliedClip* clip, GrProcessorAnalysisCoverage geometryCoverage,
|
||||
GrProcessorAnalysisColor* geometryColor) {
|
||||
SkDEBUGCODE(fDidAnalysis = true);
|
||||
@ -94,15 +94,14 @@ GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture(
|
||||
fRequiresDstTexture = analysis.requiresDstTexture();
|
||||
fUsesLocalCoords = analysis.usesLocalCoords();
|
||||
fCompatibleWithAlphaAsCoveage = analysis.isCompatibleWithCoverageAsAlpha();
|
||||
return analysis.requiresDstTexture() ? GrDrawOp::RequiresDstTexture::kYes
|
||||
: GrDrawOp::RequiresDstTexture::kNo;
|
||||
return analysis;
|
||||
}
|
||||
|
||||
GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture(
|
||||
GrProcessorSet::Analysis GrSimpleMeshDrawOpHelper::finalizeProcessors(
|
||||
const GrCaps& caps, const GrAppliedClip* clip, GrProcessorAnalysisCoverage geometryCoverage,
|
||||
SkPMColor4f* geometryColor) {
|
||||
GrProcessorAnalysisColor color = *geometryColor;
|
||||
auto result = this->xpRequiresDstTexture(caps, clip, geometryCoverage, &color);
|
||||
auto result = this->finalizeProcessors(caps, clip, geometryCoverage, &color);
|
||||
color.isConstant(geometryColor);
|
||||
return result;
|
||||
}
|
||||
|
@ -68,18 +68,18 @@ public:
|
||||
* this may be set to a known color in which case the op must output this
|
||||
* color from its geometry processor instead.
|
||||
*/
|
||||
GrDrawOp::RequiresDstTexture xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip,
|
||||
GrProcessorAnalysisCoverage geometryCoverage,
|
||||
GrProcessorAnalysisColor* geometryColor);
|
||||
GrProcessorSet::Analysis finalizeProcessors(const GrCaps& caps, const GrAppliedClip*,
|
||||
GrProcessorAnalysisCoverage geometryCoverage,
|
||||
GrProcessorAnalysisColor* geometryColor);
|
||||
|
||||
/**
|
||||
* Version of above that can be used by ops that have a constant color geometry processor
|
||||
* output. The op passes this color as 'geometryColor' and after return if 'geometryColor' has
|
||||
* changed the op must override its geometry processor color output with the new color.
|
||||
*/
|
||||
GrDrawOp::RequiresDstTexture xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*,
|
||||
GrProcessorAnalysisCoverage geometryCoverage,
|
||||
SkPMColor4f* geometryColor);
|
||||
GrProcessorSet::Analysis finalizeProcessors(const GrCaps&, const GrAppliedClip*,
|
||||
GrProcessorAnalysisCoverage geometryCoverage,
|
||||
SkPMColor4f* geometryColor);
|
||||
|
||||
bool isTrivial() const {
|
||||
return fProcessors == nullptr;
|
||||
@ -173,7 +173,7 @@ public:
|
||||
using GrSimpleMeshDrawOpHelper::aaType;
|
||||
using GrSimpleMeshDrawOpHelper::setAAType;
|
||||
using GrSimpleMeshDrawOpHelper::isTrivial;
|
||||
using GrSimpleMeshDrawOpHelper::xpRequiresDstTexture;
|
||||
using GrSimpleMeshDrawOpHelper::finalizeProcessors;
|
||||
using GrSimpleMeshDrawOpHelper::usesLocalCoords;
|
||||
using GrSimpleMeshDrawOpHelper::compatibleWithAlphaAsCoverage;
|
||||
|
||||
|
@ -297,9 +297,9 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fShapes.front().fColor);
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fShapes.front().fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -162,9 +162,8 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
|
||||
&fColor);
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kNone, &fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -405,9 +404,9 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fRects.back().fColor);
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
return fHelper.finalizeProcessors(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
|
||||
&fRects.back().fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -224,11 +224,11 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorAnalysisCoverage coverage = fAntiAlias
|
||||
? GrProcessorAnalysisCoverage::kSingleChannel
|
||||
: GrProcessorAnalysisCoverage::kNone;
|
||||
return fHelper.xpRequiresDstTexture(caps, clip, coverage, &fColor);
|
||||
return fHelper.finalizeProcessors(caps, clip, coverage, &fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -186,14 +186,14 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
SkASSERT(!fFinalized);
|
||||
fFinalized = true;
|
||||
for (unsigned p = 0; p < fProxyCnt; ++p) {
|
||||
fProxies[p].fProxy->addPendingRead();
|
||||
fProxies[p].fProxy->unref();
|
||||
}
|
||||
return RequiresDstTexture::kNo;
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override {
|
||||
|
@ -280,8 +280,8 @@ private:
|
||||
|
||||
const char* name() const override { return "GrMeshTestOp"; }
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override {
|
||||
|
@ -131,8 +131,8 @@ private:
|
||||
|
||||
const char* name() const override { return "GrPipelineDynamicStateTestOp"; }
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override {
|
||||
|
@ -108,8 +108,8 @@ public:
|
||||
|
||||
const char* name() const override { return "LazyProxyTest::Op"; }
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
|
||||
@ -339,8 +339,8 @@ private:
|
||||
|
||||
const char* name() const override { return "LazyFailedInstantiationTestOp"; }
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override {
|
||||
@ -414,8 +414,8 @@ private:
|
||||
|
||||
const char* name() const override { return "LazyDeinstantiateTestOp"; }
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override {}
|
||||
|
@ -72,14 +72,14 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip*) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip*) override {
|
||||
// Set the color to unknown because the subclass may change the color later.
|
||||
GrProcessorAnalysisColor gpColor;
|
||||
gpColor.setToUnknown();
|
||||
// We ignore the clip so pass this rather than the GrAppliedClip param.
|
||||
static GrAppliedClip kNoClip;
|
||||
return fHelper.xpRequiresDstTexture(caps, &kNoClip, GrProcessorAnalysisCoverage::kNone,
|
||||
&gpColor);
|
||||
return fHelper.finalizeProcessors(caps, &kNoClip, GrProcessorAnalysisCoverage::kNone,
|
||||
&gpColor);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -42,8 +42,8 @@ public:
|
||||
return FixedFunctionFlags::kNone;
|
||||
}
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return RequiresDstTexture::kNo;
|
||||
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*) override {
|
||||
return GrProcessorSet::EmptySetAnalysis();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -45,12 +45,11 @@ public:
|
||||
|
||||
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
||||
|
||||
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
GrProcessorSet::Analysis finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
|
||||
static constexpr GrProcessorAnalysisColor kUnknownColor;
|
||||
SkPMColor4f overrideColor;
|
||||
fProcessors.finalize(kUnknownColor, GrProcessorAnalysisCoverage::kNone, clip, false, caps,
|
||||
&overrideColor);
|
||||
return RequiresDstTexture::kNo;
|
||||
return fProcessors.finalize(kUnknownColor, GrProcessorAnalysisCoverage::kNone, clip, false,
|
||||
caps, &overrideColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user