Remove clamping of kPlus with F16 configs

The most common use-case for F16 is to draw things that are explicitly
outside of [0,1]. We can't prevent out-of-range values in general, users
could just draw out-of-range content in src mode. We've decided that
it's best to avoid surprising behavior, and trust the user in these
situations.

This effectively reverts https://skia-review.googlesource.com/c/skia/+/48183

Bug: skia:
Change-Id: I71c2dd925c567e2862d96ab70c752f19245a69c4
Reviewed-on: https://skia-review.googlesource.com/140500
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2018-07-11 10:02:07 -04:00 committed by Skia Commit-Bot
parent c87cfb674b
commit 532b3f944a
54 changed files with 138 additions and 275 deletions

View File

@ -29,10 +29,9 @@ class BezierTestOp : public GrMeshDrawOp {
public:
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
auto analysis = fProcessorSet.finalize(fColor, GrProcessorAnalysisCoverage::kSingleChannel,
clip, false, caps, dstIsClamped, &fColor);
clip, false, caps, &fColor);
return analysis.requiresDstTexture() ? RequiresDstTexture::kYes : RequiresDstTexture::kNo;
}

View File

@ -58,10 +58,9 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
auto analysis = fProcessors.finalize(fColor, GrProcessorAnalysisCoverage::kNone, clip,
false, caps, dstIsClamped, &fColor);
false, caps, &fColor);
return analysis.requiresDstTexture() ? RequiresDstTexture::kYes : RequiresDstTexture::kNo;
}

View File

@ -282,15 +282,6 @@ enum class GrAllowMixedSamples : bool { kNo = false, kYes = true };
GrAAType GrChooseAAType(GrAA, GrFSAAType, GrAllowMixedSamples, const GrCaps&);
/**
* Some pixel configs are inherently clamped to [0,1], while others can hold values outside of that
* range. This is important for blending - the latter category may require manual clamping.
*/
enum class GrPixelConfigIsClamped : bool {
kNo = false, // F16 or F32
kYes = true, // Any UNORM type
};
/**
* Types of shader-language-specific boxed variables we can create. (Currently only GrGLShaderVars,
* but should be applicable to other shader languages.)
@ -1075,35 +1066,6 @@ static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) {
return false;
}
static inline bool GrPixelConfigIsFloatingPoint(GrPixelConfig config) {
switch (config) {
case kRGBA_float_GrPixelConfig:
case kRG_float_GrPixelConfig:
case kAlpha_half_GrPixelConfig:
case kAlpha_half_as_Red_GrPixelConfig:
case kRGBA_half_GrPixelConfig:
return true;
case kUnknown_GrPixelConfig:
case kAlpha_8_GrPixelConfig:
case kAlpha_8_as_Alpha_GrPixelConfig:
case kAlpha_8_as_Red_GrPixelConfig:
case kGray_8_GrPixelConfig:
case kGray_8_as_Lum_GrPixelConfig:
case kGray_8_as_Red_GrPixelConfig:
case kRGB_565_GrPixelConfig:
case kRGBA_4444_GrPixelConfig:
case kRGBA_8888_GrPixelConfig:
case kRGB_888_GrPixelConfig:
case kBGRA_8888_GrPixelConfig:
case kSRGBA_8888_GrPixelConfig:
case kSBGRA_8888_GrPixelConfig:
case kRGBA_1010102_GrPixelConfig:
return false;
}
SK_ABORT("Invalid pixel config");
return false;
}
/**
* Precision qualifier that should be used with a sampler.
*/
@ -1137,11 +1099,6 @@ static inline GrSLPrecision GrSLSamplerPrecision(GrPixelConfig config) {
return kHigh_GrSLPrecision;
}
static inline GrPixelConfigIsClamped GrGetPixelConfigIsClamped(GrPixelConfig config) {
return GrPixelConfigIsFloatingPoint(config) ? GrPixelConfigIsClamped::kNo
: GrPixelConfigIsClamped::kYes;
}
/**
* Like SkColorType this describes a layout of pixel data in CPU memory. It specifies the channels,
* their type, and width. This exists so that the GPU backend can have private types that have no

View File

@ -86,8 +86,7 @@ public:
private:
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped) override {
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
return RequiresDstTexture::kNo;
}
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }

View File

@ -202,7 +202,7 @@ void GrAtlasTextOp::finalizeForTextTarget(uint32_t color, const GrCaps& caps) {
for (int i = 0; i < fGeoCount; ++i) {
fGeoData[i].fColor = color;
}
this->finalize(caps, nullptr /* applied clip */, GrPixelConfigIsClamped::kNo);
this->finalize(caps, nullptr /* applied clip */);
}
void GrAtlasTextOp::executeForTextTarget(SkAtlasTextTarget* target) {

View File

@ -159,9 +159,7 @@ bool GrProcessorSet::operator==(const GrProcessorSet& that) const {
GrProcessorSet::Analysis GrProcessorSet::finalize(const GrProcessorAnalysisColor& colorInput,
const GrProcessorAnalysisCoverage coverageInput,
const GrAppliedClip* clip, bool isMixedSamples,
const GrCaps& caps,
GrPixelConfigIsClamped dstIsClamped,
GrColor* overrideInputColor) {
const GrCaps& caps, GrColor* overrideInputColor) {
SkASSERT(!this->isFinalized());
SkASSERT(!fFragmentProcessorOffset);
@ -207,7 +205,7 @@ GrProcessorSet::Analysis GrProcessorSet::finalize(const GrProcessorAnalysisColor
}
GrXPFactory::AnalysisProperties props = GrXPFactory::GetAnalysisProperties(
this->xpFactory(), colorAnalysis.outputColor(), outputCoverage, caps, dstIsClamped);
this->xpFactory(), colorAnalysis.outputColor(), outputCoverage, caps);
if (!this->numCoverageFragmentProcessors() &&
GrProcessorAnalysisCoverage::kNone == coverageInput) {
analysis.fCanCombineOverlappedStencilAndCover = SkToBool(
@ -241,7 +239,7 @@ GrProcessorSet::Analysis GrProcessorSet::finalize(const GrProcessorAnalysisColor
fColorFragmentProcessorCnt -= colorFPsToEliminate;
auto xp = GrXPFactory::MakeXferProcessor(this->xpFactory(), colorAnalysis.outputColor(),
outputCoverage, isMixedSamples, caps, dstIsClamped);
outputCoverage, isMixedSamples, caps);
fXP.fProcessor = xp.release();
fFlags |= kFinalized_Flag;

View File

@ -141,8 +141,7 @@ public:
*/
Analysis finalize(const GrProcessorAnalysisColor& colorInput,
const GrProcessorAnalysisCoverage coverageInput, const GrAppliedClip*,
bool isMixedSamples, const GrCaps&, GrPixelConfigIsClamped,
GrColor* inputColorOverride);
bool isMixedSamples, const GrCaps&, GrColor* inputColorOverride);
bool isFinalized() const { return SkToBool(kFinalized_Flag & fFlags); }

View File

@ -1763,11 +1763,8 @@ uint32_t GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<Gr
this->setNeedsStencil();
}
GrPixelConfigIsClamped dstIsClamped =
GrGetPixelConfigIsClamped(this->colorSpaceInfo().config());
GrXferProcessor::DstProxy dstProxy;
if (GrDrawOp::RequiresDstTexture::kYes == op->finalize(*this->caps(), &appliedClip,
dstIsClamped)) {
if (GrDrawOp::RequiresDstTexture::kYes == op->finalize(*this->caps(), &appliedClip)) {
if (!this->setupDstProxy(this->asRenderTargetProxy(), clip, op->bounds(), &dstProxy)) {
fContext->contextPriv().opMemoryPool()->release(std::move(op));
return SK_InvalidUniqueID;

View File

@ -160,14 +160,12 @@ GrXPFactory::AnalysisProperties GrXPFactory::GetAnalysisProperties(
const GrXPFactory* factory,
const GrProcessorAnalysisColor& color,
const GrProcessorAnalysisCoverage& coverage,
const GrCaps& caps,
GrPixelConfigIsClamped dstIsClamped) {
const GrCaps& caps) {
AnalysisProperties result;
if (factory) {
result = factory->analysisProperties(color, coverage, caps, dstIsClamped);
result = factory->analysisProperties(color, coverage, caps);
} else {
result = GrPorterDuffXPFactory::SrcOverAnalysisProperties(color, coverage, caps,
dstIsClamped);
result = GrPorterDuffXPFactory::SrcOverAnalysisProperties(color, coverage, caps);
}
SkASSERT(!(result & AnalysisProperties::kRequiresDstTexture));
if ((result & AnalysisProperties::kReadsDstInShader) &&
@ -184,11 +182,10 @@ sk_sp<const GrXferProcessor> GrXPFactory::MakeXferProcessor(const GrXPFactory* f
const GrProcessorAnalysisColor& color,
GrProcessorAnalysisCoverage coverage,
bool hasMixedSamples,
const GrCaps& caps,
GrPixelConfigIsClamped dstIsClamped) {
const GrCaps& caps) {
SkASSERT(!hasMixedSamples || caps.shaderCaps()->dualSourceBlendingSupport());
if (factory) {
return factory->makeXferProcessor(color, coverage, hasMixedSamples, caps, dstIsClamped);
return factory->makeXferProcessor(color, coverage, hasMixedSamples, caps);
} else {
return GrPorterDuffXPFactory::MakeSrcOverXferProcessor(color, coverage, hasMixedSamples,
caps);

View File

@ -292,14 +292,12 @@ public:
const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
const GrCaps& caps,
GrPixelConfigIsClamped dstIsClamped);
const GrCaps& caps);
static AnalysisProperties GetAnalysisProperties(const GrXPFactory*,
const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
const GrCaps&,
GrPixelConfigIsClamped);
const GrCaps&);
protected:
constexpr GrXPFactory() {}
@ -308,8 +306,7 @@ private:
virtual sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
const GrCaps&,
GrPixelConfigIsClamped) const = 0;
const GrCaps&) const = 0;
/**
* Subclass analysis implementation. This should not return kNeedsDstInTexture as that will be
@ -317,8 +314,7 @@ private:
*/
virtual AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
const GrCaps&,
GrPixelConfigIsClamped) const = 0;
const GrCaps&) const = 0;
};
#if defined(__GNUC__)
#pragma GCC diagnostic pop

View File

@ -109,12 +109,11 @@ GrCCDrawPathsOp::SingleDraw::~SingleDraw() {
}
GrDrawOp::RequiresDstTexture GrCCDrawPathsOp::finalize(const GrCaps& caps,
const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) {
const GrAppliedClip* clip) {
SkASSERT(1 == fNumDraws); // There should only be one single path draw in this Op right now.
GrProcessorSet::Analysis analysis =
fProcessors.finalize(fDraws.head().fColor, GrProcessorAnalysisCoverage::kSingleChannel,
clip, false, caps, dstIsClamped, &fDraws.head().fColor);
clip, false, caps, &fDraws.head().fColor);
return RequiresDstTexture(analysis.requiresDstTexture());
}

View File

@ -36,8 +36,7 @@ public:
const char* name() const override { return "GrCCDrawPathsOp"; }
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped) override;
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override;
bool onCombineIfPossible(GrOp*, const GrCaps&) override;
void visitProxies(const VisitProxyFunc& fn) const override { fProcessors.visitProxies(fn); }
void onPrepare(GrOpFlushState*) override {}

View File

@ -24,8 +24,9 @@ namespace {
class AtlasOp : public GrDrawOp {
public:
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped) override { return RequiresDstTexture::kNo; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
return RequiresDstTexture::kNo;
}
bool onCombineIfPossible(GrOp* other, const GrCaps&) override {
SK_ABORT("Only expected one Op per CCPR atlas.");
return true;

View File

@ -211,8 +211,7 @@ sk_sp<const GrXferProcessor> GrCoverageSetOpXPFactory::makeXferProcessor(
const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
const GrCaps& caps,
GrPixelConfigIsClamped dstIsClamped) const {
const GrCaps& caps) const {
// We don't support inverting coverage with mixed samples. We don't expect to ever want this in
// the future, however we could at some point make this work using an inverted coverage
// modulation table. Note that an inverted table still won't work if there are coverage procs.

View File

@ -37,13 +37,11 @@ private:
sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
const GrCaps&,
GrPixelConfigIsClamped) const override;
const GrCaps&) const override;
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
const GrCaps&,
GrPixelConfigIsClamped) const override {
const GrCaps&) const override {
return AnalysisProperties::kIgnoresInputColor;
}

View File

@ -217,13 +217,11 @@ private:
sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
const GrCaps&,
GrPixelConfigIsClamped) const override;
const GrCaps&) const override;
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
const GrCaps&,
GrPixelConfigIsClamped) const override;
const GrCaps&) const override;
GR_DECLARE_XP_FACTORY_TEST
@ -243,8 +241,7 @@ sk_sp<const GrXferProcessor> CustomXPFactory::makeXferProcessor(
const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage coverage,
bool hasMixedSamples,
const GrCaps& caps,
GrPixelConfigIsClamped dstIsClamped) const {
const GrCaps& caps) const {
SkASSERT(GrCustomXfermode::IsSupportedMode(fMode));
if (can_use_hw_blend_equation(fHWBlendEquation, coverage, caps)) {
return sk_sp<GrXferProcessor>(new CustomXP(fMode, fHWBlendEquation));
@ -254,7 +251,7 @@ sk_sp<const GrXferProcessor> CustomXPFactory::makeXferProcessor(
GrXPFactory::AnalysisProperties CustomXPFactory::analysisProperties(
const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage& coverage,
const GrCaps& caps, GrPixelConfigIsClamped dstIsClamped) const {
const GrCaps& caps) const {
/*
The general SVG blend equation is defined in the spec as follows:

View File

@ -79,8 +79,7 @@ sk_sp<const GrXferProcessor> GrDisableColorXPFactory::makeXferProcessor(
const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
const GrCaps& caps,
GrPixelConfigIsClamped dstIsClamped) const {
const GrCaps& caps) const {
return sk_sp<const GrXferProcessor>(new DisableColorXP);
}

View File

@ -30,8 +30,7 @@ private:
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
const GrCaps&,
GrPixelConfigIsClamped) const override {
const GrCaps&) const override {
return AnalysisProperties::kCompatibleWithAlphaAsCoverage |
AnalysisProperties::kIgnoresInputColor;
}
@ -39,8 +38,7 @@ private:
sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
const GrCaps&,
GrPixelConfigIsClamped) const override;
const GrCaps&) const override;
GR_DECLARE_XP_FACTORY_TEST

View File

@ -759,7 +759,7 @@ const GrXPFactory* GrPorterDuffXPFactory::Get(SkBlendMode blendMode) {
sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::makeXferProcessor(
const GrProcessorAnalysisColor& color, GrProcessorAnalysisCoverage coverage,
bool hasMixedSamples, const GrCaps& caps, GrPixelConfigIsClamped dstIsClamped) const {
bool hasMixedSamples, const GrCaps& caps) const {
BlendFormula blendFormula;
bool isLCD = coverage == GrProcessorAnalysisCoverage::kLCD;
if (isLCD) {
@ -778,10 +778,8 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::makeXferProcessor(
hasMixedSamples, fBlendMode);
}
bool needsClamp = SkBlendMode::kPlus == fBlendMode;
if ((blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) ||
(isLCD && (SkBlendMode::kSrcOver != fBlendMode /*|| !color.isOpaque()*/)) ||
(needsClamp && (GrPixelConfigIsClamped::kNo == dstIsClamped))) {
(isLCD && (SkBlendMode::kSrcOver != fBlendMode /*|| !color.isOpaque()*/))) {
return sk_sp<const GrXferProcessor>(new ShaderPDXferProcessor(hasMixedSamples, fBlendMode,
coverage));
}
@ -790,7 +788,7 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::makeXferProcessor(
static inline GrXPFactory::AnalysisProperties analysis_properties(
const GrProcessorAnalysisColor& color, const GrProcessorAnalysisCoverage& coverage,
const GrCaps& caps, GrPixelConfigIsClamped dstIsClamped, SkBlendMode mode) {
const GrCaps& caps, SkBlendMode mode) {
using AnalysisProperties = GrXPFactory::AnalysisProperties;
AnalysisProperties props = AnalysisProperties::kNone;
bool hasCoverage = GrProcessorAnalysisCoverage::kNone != coverage;
@ -837,11 +835,6 @@ static inline GrXPFactory::AnalysisProperties analysis_properties(
}
}
bool needsClamp = SkBlendMode::kPlus == mode;
if (needsClamp && (GrPixelConfigIsClamped::kNo == dstIsClamped)) {
props |= AnalysisProperties::kReadsDstInShader;
}
if (!formula.modifiesDst() || !formula.usesInputColor()) {
props |= AnalysisProperties::kIgnoresInputColor;
}
@ -857,9 +850,8 @@ static inline GrXPFactory::AnalysisProperties analysis_properties(
GrXPFactory::AnalysisProperties GrPorterDuffXPFactory::analysisProperties(
const GrProcessorAnalysisColor& color,
const GrProcessorAnalysisCoverage& coverage,
const GrCaps& caps,
GrPixelConfigIsClamped dstIsClamped) const {
return analysis_properties(color, coverage, caps, dstIsClamped, fBlendMode);
const GrCaps& caps) const {
return analysis_properties(color, coverage, caps, fBlendMode);
}
GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
@ -946,7 +938,6 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::MakeNoCoverageXP(SkBlendMode
GrXPFactory::AnalysisProperties GrPorterDuffXPFactory::SrcOverAnalysisProperties(
const GrProcessorAnalysisColor& color,
const GrProcessorAnalysisCoverage& coverage,
const GrCaps& caps,
GrPixelConfigIsClamped dstIsClamped) {
return analysis_properties(color, coverage, caps, dstIsClamped, SkBlendMode::kSrcOver);
const GrCaps& caps) {
return analysis_properties(color, coverage, caps, SkBlendMode::kSrcOver);
}

View File

@ -41,8 +41,7 @@ public:
static AnalysisProperties SrcOverAnalysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
const GrCaps&,
GrPixelConfigIsClamped);
const GrCaps&);
private:
constexpr GrPorterDuffXPFactory(SkBlendMode);
@ -50,13 +49,11 @@ private:
sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
const GrCaps&,
GrPixelConfigIsClamped) const override;
const GrCaps&) const override;
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
const GrCaps&,
GrPixelConfigIsClamped) const override;
const GrCaps&) const override;
GR_DECLARE_XP_FACTORY_TEST
static void TestGetXPOutputTypes(const GrXferProcessor*, int* outPrimary, int* outSecondary);

View File

@ -782,10 +782,8 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel,
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
&fPaths.back().fColor);
}

View File

@ -229,11 +229,10 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor color = this->first()->color();
auto result = fHelper.xpRequiresDstTexture(
caps, clip, dstIsClamped, GrProcessorAnalysisCoverage::kSingleChannel, &color);
caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, &color);
this->first()->setColor(color);
return result;
}

View File

@ -823,10 +823,9 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel, &fColor);
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
&fColor);
}
private:

View File

@ -200,10 +200,8 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel,
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
&fPaths.back().fColor);
}

View File

@ -202,10 +202,8 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel,
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
&fRects.back().fColor);
}

View File

@ -138,8 +138,7 @@ GrDrawOp::FixedFunctionFlags GrAtlasTextOp::fixedFunctionFlags() const {
}
GrDrawOp::RequiresDstTexture GrAtlasTextOp::finalize(const GrCaps& caps,
const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) {
const GrAppliedClip* clip) {
GrProcessorAnalysisCoverage coverage;
GrProcessorAnalysisColor color;
if (kColorBitmapMask_MaskType == fMaskType) {
@ -162,8 +161,7 @@ GrDrawOp::RequiresDstTexture GrAtlasTextOp::finalize(const GrCaps& caps,
coverage = GrProcessorAnalysisCoverage::kNone;
break;
}
auto analysis = fProcessors.finalize(color, coverage, clip, false, caps, dstIsClamped,
&fGeoData[0].fColor);
auto analysis = fProcessors.finalize(color, coverage, clip, false, caps, &fGeoData[0].fColor);
fUsesLocalCoords = analysis.usesLocalCoords();
fCanCombineOnTouchOrOverlap =
!analysis.requiresDstTexture() &&

View File

@ -74,8 +74,7 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override;
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override;
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
enum MaskType {
kGrayscaleCoverageMask_MaskType,

View File

@ -311,16 +311,14 @@ public:
return flags;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrProcessorAnalysisCoverage coverage;
if (AAMode::kNone == fAAMode && !clip->numClipCoverageFragmentProcessors()) {
coverage = GrProcessorAnalysisCoverage::kNone;
} else {
coverage = GrProcessorAnalysisCoverage::kSingleChannel;
}
auto analysis = fProcessorSet.finalize(fColor, coverage, clip, false, caps, dstIsClamped,
&fColor);
auto analysis = fProcessorSet.finalize(fColor, coverage, clip, false, caps, &fColor);
fDisallowCombineOnTouchOrOverlap = analysis.requiresDstTexture() ||
(fProcessorSet.xferProcessor() &&
fProcessorSet.xferProcessor()->xferBarrierType(caps));

View File

@ -389,12 +389,11 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrProcessorAnalysisCoverage gpCoverage =
this->coverage() == 0xFF ? GrProcessorAnalysisCoverage::kNone
: GrProcessorAnalysisCoverage::kSingleChannel;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, gpCoverage, &fColor);
return fHelper.xpRequiresDstTexture(caps, clip, gpCoverage, &fColor);
}
private:

View File

@ -178,16 +178,15 @@ GrDrawOp::FixedFunctionFlags GrDrawAtlasOp::fixedFunctionFlags() const {
}
GrDrawOp::RequiresDstTexture GrDrawAtlasOp::finalize(const GrCaps& caps,
const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) {
const GrAppliedClip* clip) {
GrProcessorAnalysisColor gpColor;
if (this->hasColors()) {
gpColor.setToUnknown();
} else {
gpColor.setToConstant(fColor);
}
auto result = fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kNone, &gpColor);
auto result = fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
&gpColor);
if (gpColor.isConstant(&fColor)) {
fHasColors = false;
}

View File

@ -46,8 +46,7 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override;
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override;
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
private:
void onPrepareDraws(Target*) override;

View File

@ -44,8 +44,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*,
GrPixelConfigIsClamped) = 0;
virtual RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) = 0;
private:
typedef GrOp INHERITED;

View File

@ -29,9 +29,8 @@ protected:
}
return FixedFunctionFlags::kUsesStencil;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
return this->doProcessorAnalysis(caps, clip, dstIsClamped).requiresDstTexture()
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return this->doProcessorAnalysis(caps, clip).requiresDstTexture()
? RequiresDstTexture::kYes : RequiresDstTexture::kNo;
}
@ -47,11 +46,10 @@ protected:
GrProcessorSet detachProcessors() { return std::move(fProcessorSet); }
inline GrPipeline::InitArgs pipelineInitArgs(const GrOpFlushState&);
const GrProcessorSet::Analysis& doProcessorAnalysis(const GrCaps& caps,
const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) {
const GrAppliedClip* clip) {
bool isMixedSamples = GrAAType::kMixedSamples == fAAType;
fAnalysis = fProcessorSet.finalize(fInputColor, GrProcessorAnalysisCoverage::kNone, clip,
isMixedSamples, caps, dstIsClamped, &fInputColor);
isMixedSamples, caps, &fInputColor);
return fAnalysis;
}
const GrProcessorSet::Analysis& processorAnalysis() const {

View File

@ -131,16 +131,15 @@ GrDrawOp::FixedFunctionFlags GrDrawVerticesOp::fixedFunctionFlags() const {
}
GrDrawOp::RequiresDstTexture GrDrawVerticesOp::finalize(const GrCaps& caps,
const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) {
const GrAppliedClip* clip) {
GrProcessorAnalysisColor gpColor;
if (this->requiresPerVertexColors()) {
gpColor.setToUnknown();
} else {
gpColor.setToConstant(fMeshes.front().fColor);
}
auto result = fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kNone, &gpColor);
auto result = fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
&gpColor);
if (gpColor.isConstant(&fMeshes.front().fColor)) {
fMeshes.front().fIgnoreColors = true;
fFlags &= ~kRequiresPerVertexColors_Flag;

View File

@ -59,8 +59,7 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override;
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override;
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
private:
enum class ColorArrayType {

View File

@ -187,14 +187,13 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
auto opaque = GrColorIsOpaque(fPatches[0].fColor) && GrPixelConfigIsOpaque(fProxy->config())
? GrProcessorAnalysisColor::Opaque::kYes
: GrProcessorAnalysisColor::Opaque::kNo;
auto analysisColor = GrProcessorAnalysisColor(opaque);
auto result = fHelper.xpRequiresDstTexture(
caps, clip, dstIsClamped, GrProcessorAnalysisCoverage::kNone, &analysisColor);
caps, clip, GrProcessorAnalysisCoverage::kNone, &analysisColor);
analysisColor.isConstant(&fPatches[0].fColor);
return result;
}

View File

@ -163,11 +163,9 @@ public:
return str;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fRects.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kNone, color);
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, color);
}
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
@ -294,11 +292,9 @@ public:
return str;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fRects.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kNone, color);
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, color);
}
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }

View File

@ -133,10 +133,9 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kNone, &fColor);
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
&fColor);
}
private:

View File

@ -1140,11 +1140,10 @@ public:
return string;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fCircles.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel, color);
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
}
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
@ -1632,11 +1631,10 @@ public:
return string;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fCircles.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel, color);
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
}
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
@ -1946,11 +1944,10 @@ public:
return string;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fEllipses.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel, color);
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
}
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
@ -2185,11 +2182,10 @@ public:
return string;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fEllipses.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel, color);
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
}
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
@ -2519,11 +2515,10 @@ public:
return string;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fRRects.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel, color);
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
}
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
@ -2885,11 +2880,10 @@ public:
return string;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fRRects.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel, color);
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
}
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }

View File

@ -102,10 +102,9 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kNone, &fRegions[0].fColor);
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
&fRegions[0].fColor);
}
private:

View File

@ -258,8 +258,7 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped) override {
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
return RequiresDstTexture::kNo;
}

View File

@ -64,8 +64,8 @@ bool GrSimpleMeshDrawOpHelper::isCompatible(const GrSimpleMeshDrawOpHelper& that
}
GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture(
const GrCaps& caps, const GrAppliedClip* clip, GrPixelConfigIsClamped dstIsClamped,
GrProcessorAnalysisCoverage geometryCoverage, GrProcessorAnalysisColor* geometryColor) {
const GrCaps& caps, const GrAppliedClip* clip, GrProcessorAnalysisCoverage geometryCoverage,
GrProcessorAnalysisColor* geometryColor) {
SkDEBUGCODE(fDidAnalysis = true);
GrProcessorSet::Analysis analysis;
if (fProcessors) {
@ -78,7 +78,7 @@ GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture(
bool isMixedSamples = this->aaType() == GrAAType::kMixedSamples;
GrColor overrideColor;
analysis = fProcessors->finalize(*geometryColor, coverage, clip, isMixedSamples, caps,
dstIsClamped, &overrideColor);
&overrideColor);
if (analysis.inputColorIsOverridden()) {
*geometryColor = overrideColor;
}
@ -93,10 +93,10 @@ GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture(
}
GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture(
const GrCaps& caps, const GrAppliedClip* clip, GrPixelConfigIsClamped dstIsClamped,
GrProcessorAnalysisCoverage geometryCoverage, GrColor* geometryColor) {
const GrCaps& caps, const GrAppliedClip* clip, GrProcessorAnalysisCoverage geometryCoverage,
GrColor* geometryColor) {
GrProcessorAnalysisColor color = *geometryColor;
auto result = this->xpRequiresDstTexture(caps, clip, dstIsClamped, geometryCoverage, &color);
auto result = this->xpRequiresDstTexture(caps, clip, geometryCoverage, &color);
color.isConstant(geometryColor);
return result;
}

View File

@ -67,7 +67,6 @@ public:
* color from its geometry processor instead.
*/
GrDrawOp::RequiresDstTexture xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped,
GrProcessorAnalysisCoverage geometryCoverage,
GrProcessorAnalysisColor* geometryColor);
@ -77,7 +76,6 @@ public:
* changed the op must override its geometry processor color output with the new color.
*/
GrDrawOp::RequiresDstTexture xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped dstIsClamped,
GrProcessorAnalysisCoverage geometryCoverage,
GrColor* geometryColor);

View File

@ -293,10 +293,8 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped,
GrProcessorAnalysisCoverage::kSingleChannel,
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
&fShapes.front().fColor);
}

View File

@ -220,12 +220,11 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrProcessorAnalysisCoverage coverage = fAntiAlias
? GrProcessorAnalysisCoverage::kSingleChannel
: GrProcessorAnalysisCoverage::kNone;
return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, coverage, &fColor);
return fHelper.xpRequiresDstTexture(caps, clip, coverage, &fColor);
}
private:

View File

@ -683,8 +683,7 @@ public:
return str;
}
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
SkASSERT(!fFinalized);
SkASSERT(1 == fProxyCnt);
fFinalized = true;

View File

@ -202,7 +202,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo)
rtc.get(), paint,
SkMatrix::I(), text,
16, 16);
op->finalize(*context->contextPriv().caps(), nullptr, GrPixelConfigIsClamped::kNo);
op->finalize(*context->contextPriv().caps(), nullptr);
TestingUploadTarget uploadTarget;

View File

@ -275,8 +275,7 @@ private:
const char* name() const override { return "GrMeshTestOp"; }
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped) override {
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
return RequiresDstTexture::kNo;
}
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }

View File

@ -133,8 +133,7 @@ private:
const char* name() const override { return "GrPipelineDynamicStateTestOp"; }
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped) override {
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
return RequiresDstTexture::kNo;
}
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }

View File

@ -65,8 +65,7 @@ static GrProcessorSet::Analysis do_analysis(const GrXPFactory* xpf,
GrProcessorSet procs(std::move(paint));
GrColor overrideColor;
GrProcessorSet::Analysis analysis =
procs.finalize(colorInput, coverageInput, nullptr, false, caps,
GrPixelConfigIsClamped::kYes, &overrideColor);
procs.finalize(colorInput, coverageInput, nullptr, false, caps, &overrideColor);
return analysis;
}
@ -84,8 +83,7 @@ public:
fCanCombineOverlappedStencilAndCover = analysis.canCombineOverlappedStencilAndCover();
fIgnoresInputColor = analysis.inputColorIsIgnored();
sk_sp<const GrXferProcessor> xp(
GrXPFactory::MakeXferProcessor(xpf, inputColor, inputCoverage, false, caps,
GrPixelConfigIsClamped::kYes));
GrXPFactory::MakeXferProcessor(xpf, inputColor, inputCoverage, false, caps));
TEST_ASSERT(!analysis.requiresDstTexture() ||
(isLCD &&
!caps.shaderCaps()->dstReadInShaderSupport() &&
@ -1016,12 +1014,10 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver);
GrProcessorAnalysisColor color = GrColorPackRGBA(123, 45, 67, 255);
GrProcessorAnalysisCoverage coverage = GrProcessorAnalysisCoverage::kLCD;
TEST_ASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps,
GrPixelConfigIsClamped::kYes) &
TEST_ASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps) &
GrXPFactory::AnalysisProperties::kRequiresDstTexture));
sk_sp<const GrXferProcessor> xp_opaque(
GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps,
GrPixelConfigIsClamped::kYes));
GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps));
if (!xp_opaque) {
ERRORF(reporter, "Failed to create an XP with LCD coverage.");
return;
@ -1034,12 +1030,10 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
// Test with non-opaque alpha
color = GrColorPackRGBA(123, 45, 67, 221);
coverage = GrProcessorAnalysisCoverage::kLCD;
TEST_ASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps,
GrPixelConfigIsClamped::kYes) &
TEST_ASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps) &
GrXPFactory::AnalysisProperties::kRequiresDstTexture));
sk_sp<const GrXferProcessor> xp(
GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps,
GrPixelConfigIsClamped::kYes));
GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps));
if (!xp) {
ERRORF(reporter, "Failed to create an XP with LCD coverage.");
return;
@ -1090,8 +1084,7 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode);
sk_sp<const GrXferProcessor> xp(
GrXPFactory::MakeXferProcessor(xpf, colorInput, coverageType, false, caps,
GrPixelConfigIsClamped::kYes));
GrXPFactory::MakeXferProcessor(xpf, colorInput, coverageType, false, caps));
if (!xp) {
ERRORF(reporter, "Failed to create an XP without dual source blending.");
return;

View File

@ -106,8 +106,7 @@ public:
const char* name() const override { return "LazyProxyTest::Op"; }
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped) override {
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
return RequiresDstTexture::kNo;
}
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }
@ -321,8 +320,7 @@ private:
const char* name() const override { return "LazyFailedInstantiationTestOp"; }
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped) override {
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
return RequiresDstTexture::kNo;
}
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }
@ -396,8 +394,7 @@ private:
const char* name() const override { return "LazyUninstantiateTestOp"; }
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
GrPixelConfigIsClamped) override {
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
return RequiresDstTexture::kNo;
}
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }

View File

@ -72,15 +72,14 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip*,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture 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, dstIsClamped,
GrProcessorAnalysisCoverage::kNone, &gpColor);
return fHelper.xpRequiresDstTexture(caps, &kNoClip, GrProcessorAnalysisCoverage::kNone,
&gpColor);
}
protected:

View File

@ -42,8 +42,7 @@ public:
return FixedFunctionFlags::kNone;
}
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,\
GrPixelConfigIsClamped) override {
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
return RequiresDstTexture::kNo;
}

View File

@ -42,12 +42,11 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override {
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
static constexpr GrProcessorAnalysisColor kUnknownColor;
GrColor overrideColor;
fProcessors.finalize(kUnknownColor, GrProcessorAnalysisCoverage::kNone, clip, false, caps,
dstIsClamped, &overrideColor);
&overrideColor);
return RequiresDstTexture::kNo;
}