Removing tracking of whether GP/FP coverage calculations are used by XP.
Remove readsCoverage from GrPipelineOptimizations Remove kNone from GrDefaultGeoProc::Coverage Remove kIgnoreCoverage from GrXferProcessor::OptFlags Remove GrPipeline::fIgnoresCoverage Change-Id: I8f0c9337ee98b9c77af1e9a8a184519ce63822d4 Reviewed-on: https://skia-review.googlesource.com/6552 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
1e854246e6
commit
8c852be264
@ -58,10 +58,8 @@ private:
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
|
||||
Color color(this->color());
|
||||
Coverage coverage(Coverage::kSolid_Type);
|
||||
LocalCoords localCoords(LocalCoords::kUnused_Type);
|
||||
sk_sp<GrGeometryProcessor> gp(
|
||||
GrDefaultGeoProcFactory::Make(color, coverage, localCoords, SkMatrix::I()));
|
||||
sk_sp<GrGeometryProcessor> gp(GrDefaultGeoProcFactory::Make(
|
||||
color, Coverage::kSolid_Type, LocalCoords::kUnused_Type, SkMatrix::I()));
|
||||
|
||||
size_t vertexStride = gp->getVertexStride();
|
||||
SkASSERT(vertexStride == sizeof(SkPoint));
|
||||
|
@ -112,18 +112,14 @@ public:
|
||||
* GrXferProcessor will ignore color, thus no need to provide
|
||||
*/
|
||||
kIgnoreColor_OptFlag = 0x2,
|
||||
/**
|
||||
* GrXferProcessor will ignore coverage, thus no need to provide
|
||||
*/
|
||||
kIgnoreCoverage_OptFlag = 0x4,
|
||||
/**
|
||||
* Clear color stages and override input color to that returned by getOptimizations
|
||||
*/
|
||||
kOverrideColor_OptFlag = 0x8,
|
||||
kOverrideColor_OptFlag = 0x4,
|
||||
/**
|
||||
* Can tweak alpha for coverage. Currently this flag should only be used by a GrDrawOp.
|
||||
*/
|
||||
kCanTweakAlphaForCoverage_OptFlag = 0x20,
|
||||
kCanTweakAlphaForCoverage_OptFlag = 0x8,
|
||||
};
|
||||
|
||||
static const OptFlags kNone_OptFlags = (OptFlags)0;
|
||||
|
@ -35,11 +35,9 @@ public:
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix,
|
||||
bool localCoordsWillBeRead,
|
||||
bool coverageWillBeIgnored,
|
||||
uint8_t coverage) {
|
||||
return sk_sp<GrGeometryProcessor>(new DefaultGeoProc(
|
||||
gpTypeFlags, color, viewMatrix, localMatrix, coverage,
|
||||
localCoordsWillBeRead, coverageWillBeIgnored));
|
||||
gpTypeFlags, color, viewMatrix, localMatrix, coverage, localCoordsWillBeRead));
|
||||
}
|
||||
|
||||
const char* name() const override { return "DefaultGeometryProcessor"; }
|
||||
@ -55,7 +53,6 @@ public:
|
||||
const SkMatrix& localMatrix() const { return fLocalMatrix; }
|
||||
bool localCoordsWillBeRead() const { return fLocalCoordsWillBeRead; }
|
||||
uint8_t coverage() const { return fCoverage; }
|
||||
bool coverageWillBeIgnored() const { return fCoverageWillBeIgnored; }
|
||||
bool hasVertexCoverage() const { return SkToBool(fInCoverage); }
|
||||
|
||||
class GLSLProcessor : public GrGLSLGeometryProcessor {
|
||||
@ -112,22 +109,20 @@ public:
|
||||
}
|
||||
|
||||
// Setup coverage as pass through
|
||||
if (!gp.coverageWillBeIgnored()) {
|
||||
if (gp.hasVertexCoverage()) {
|
||||
fragBuilder->codeAppendf("float alpha = 1.0;");
|
||||
varyingHandler->addPassThroughAttribute(gp.inCoverage(), "alpha");
|
||||
fragBuilder->codeAppendf("%s = vec4(alpha);", args.fOutputCoverage);
|
||||
} else if (gp.coverage() == 0xff) {
|
||||
fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
|
||||
} else {
|
||||
const char* fragCoverage;
|
||||
fCoverageUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Coverage",
|
||||
&fragCoverage);
|
||||
fragBuilder->codeAppendf("%s = vec4(%s);", args.fOutputCoverage, fragCoverage);
|
||||
}
|
||||
if (gp.hasVertexCoverage()) {
|
||||
fragBuilder->codeAppendf("float alpha = 1.0;");
|
||||
varyingHandler->addPassThroughAttribute(gp.inCoverage(), "alpha");
|
||||
fragBuilder->codeAppendf("%s = vec4(alpha);", args.fOutputCoverage);
|
||||
} else if (gp.coverage() == 0xff) {
|
||||
fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
|
||||
} else {
|
||||
const char* fragCoverage;
|
||||
fCoverageUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Coverage",
|
||||
&fragCoverage);
|
||||
fragBuilder->codeAppendf("%s = vec4(%s);", args.fOutputCoverage, fragCoverage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,12 +132,11 @@ public:
|
||||
const DefaultGeoProc& def = gp.cast<DefaultGeoProc>();
|
||||
uint32_t key = def.fFlags;
|
||||
key |= def.colorIgnored() << 8;
|
||||
key |= def.coverageWillBeIgnored() << 9;
|
||||
key |= def.hasVertexColor() << 10;
|
||||
key |= def.hasVertexCoverage() << 11;
|
||||
key |= def.coverage() == 0xff ? 0x1 << 12 : 0;
|
||||
key |= def.localCoordsWillBeRead() && def.localMatrix().hasPerspective() ? 0x1 << 24 :
|
||||
0x0;
|
||||
key |= def.hasVertexColor() << 9;
|
||||
key |= def.hasVertexCoverage() << 10;
|
||||
key |= (def.coverage() == 0xff) ? (0x1 << 11) : 0;
|
||||
key |= (def.localCoordsWillBeRead() && def.localMatrix().hasPerspective()) ? (0x1 << 24)
|
||||
: 0x0;
|
||||
key |= ComputePosKey(def.viewMatrix()) << 25;
|
||||
b->add32(key);
|
||||
}
|
||||
@ -166,8 +160,7 @@ public:
|
||||
fColor = dgp.color();
|
||||
}
|
||||
|
||||
if (!dgp.coverageWillBeIgnored() &&
|
||||
dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) {
|
||||
if (dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) {
|
||||
pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(dgp.coverage()));
|
||||
fCoverage = dgp.coverage();
|
||||
}
|
||||
@ -199,19 +192,17 @@ private:
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix,
|
||||
uint8_t coverage,
|
||||
bool localCoordsWillBeRead,
|
||||
bool coverageWillBeIgnored)
|
||||
: fInPosition(nullptr)
|
||||
, fInColor(nullptr)
|
||||
, fInLocalCoords(nullptr)
|
||||
, fInCoverage(nullptr)
|
||||
, fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fLocalMatrix(localMatrix)
|
||||
, fCoverage(coverage)
|
||||
, fFlags(gpTypeFlags)
|
||||
, fLocalCoordsWillBeRead(localCoordsWillBeRead)
|
||||
, fCoverageWillBeIgnored(coverageWillBeIgnored) {
|
||||
bool localCoordsWillBeRead)
|
||||
: fInPosition(nullptr)
|
||||
, fInColor(nullptr)
|
||||
, fInLocalCoords(nullptr)
|
||||
, fInCoverage(nullptr)
|
||||
, fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fLocalMatrix(localMatrix)
|
||||
, fCoverage(coverage)
|
||||
, fFlags(gpTypeFlags)
|
||||
, fLocalCoordsWillBeRead(localCoordsWillBeRead) {
|
||||
this->initClassID<DefaultGeoProc>();
|
||||
bool hasColor = SkToBool(gpTypeFlags & kColor_GPFlag);
|
||||
bool hasExplicitLocalCoords = SkToBool(gpTypeFlags & kLocalCoord_GPFlag);
|
||||
@ -241,7 +232,6 @@ private:
|
||||
uint8_t fCoverage;
|
||||
uint32_t fFlags;
|
||||
bool fLocalCoordsWillBeRead;
|
||||
bool fCoverageWillBeIgnored;
|
||||
|
||||
GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
|
||||
|
||||
@ -267,7 +257,6 @@ sk_sp<GrGeometryProcessor> DefaultGeoProc::TestCreate(GrProcessorTestData* d) {
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool(),
|
||||
d->fRandom->nextBool(),
|
||||
GrRandomCoverage(d->fRandom));
|
||||
}
|
||||
|
||||
@ -281,7 +270,6 @@ sk_sp<GrGeometryProcessor> GrDefaultGeoProcFactory::Make(const Color& color,
|
||||
flags |= localCoords.fType == LocalCoords::kHasExplicit_Type ? kLocalCoord_GPFlag : 0;
|
||||
|
||||
uint8_t inCoverage = coverage.fCoverage;
|
||||
bool coverageWillBeIgnored = coverage.fType == Coverage::kNone_Type;
|
||||
bool localCoordsWillBeRead = localCoords.fType != LocalCoords::kUnused_Type;
|
||||
|
||||
GrColor inColor = color.fColor;
|
||||
@ -290,7 +278,6 @@ sk_sp<GrGeometryProcessor> GrDefaultGeoProcFactory::Make(const Color& color,
|
||||
viewMatrix,
|
||||
localCoords.fMatrix ? *localCoords.fMatrix : SkMatrix::I(),
|
||||
localCoordsWillBeRead,
|
||||
coverageWillBeIgnored,
|
||||
inCoverage);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ namespace GrDefaultGeoProcFactory {
|
||||
kUniform_Type,
|
||||
kAttribute_Type,
|
||||
};
|
||||
Color(GrColor color) : fType(kUniform_Type), fColor(color) {}
|
||||
explicit Color(GrColor color) : fType(kUniform_Type), fColor(color) {}
|
||||
Color(Type type) : fType(type), fColor(GrColor_ILLEGAL) {
|
||||
SkASSERT(type != kUniform_Type);
|
||||
|
||||
@ -82,12 +82,11 @@ namespace GrDefaultGeoProcFactory {
|
||||
|
||||
struct Coverage {
|
||||
enum Type {
|
||||
kNone_Type,
|
||||
kSolid_Type,
|
||||
kUniform_Type,
|
||||
kAttribute_Type,
|
||||
};
|
||||
Coverage(uint8_t coverage) : fType(kUniform_Type), fCoverage(coverage) {}
|
||||
explicit Coverage(uint8_t coverage) : fType(kUniform_Type), fCoverage(coverage) {}
|
||||
Coverage(Type type) : fType(type), fCoverage(0xff) {
|
||||
SkASSERT(type != kUniform_Type);
|
||||
}
|
||||
@ -127,8 +126,6 @@ namespace GrDefaultGeoProcFactory {
|
||||
const Coverage&,
|
||||
const LocalCoords&,
|
||||
const SkMatrix& viewMatrix);
|
||||
|
||||
inline size_t DefaultVertexStride() { return sizeof(PositionAttr); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -21,7 +21,6 @@ public:
|
||||
const GrShaderCaps&,
|
||||
GrProcessorKeyBuilder* b) {
|
||||
b->add32(SkToInt(pathProc.optimizations().readsColor()) |
|
||||
(SkToInt(pathProc.optimizations().readsCoverage()) << 1) |
|
||||
(SkToInt(pathProc.viewMatrix().hasPerspective()) << 2));
|
||||
}
|
||||
|
||||
@ -48,9 +47,7 @@ public:
|
||||
}
|
||||
|
||||
// setup constant solid coverage
|
||||
if (pathProc.optimizations().readsCoverage()) {
|
||||
fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
|
||||
}
|
||||
fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
|
||||
}
|
||||
|
||||
void emitTransforms(GrGLSLVaryingHandler* varyingHandler,
|
||||
|
@ -146,9 +146,6 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
|
||||
optimizations->fFlags |= GrPipelineOptimizations::kUseOverrideColor_Flag;
|
||||
optimizations->fOverrideColor = overrideColor;
|
||||
}
|
||||
if (!SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag)) {
|
||||
optimizations->fFlags |= GrPipelineOptimizations::kReadsCoverage_Flag;
|
||||
}
|
||||
if (usesLocalCoords) {
|
||||
optimizations->fFlags |= GrPipelineOptimizations::kReadsLocalCoords_Flag;
|
||||
}
|
||||
@ -200,16 +197,10 @@ void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin
|
||||
const GrProcOptInfo& coveragePOI,
|
||||
int* firstColorProcessorIdx,
|
||||
int* firstCoverageProcessorIdx) {
|
||||
fIgnoresCoverage = SkToBool(flags & GrXferProcessor::kIgnoreCoverage_OptFlag);
|
||||
|
||||
if ((flags & GrXferProcessor::kIgnoreColor_OptFlag) ||
|
||||
(flags & GrXferProcessor::kOverrideColor_OptFlag)) {
|
||||
*firstColorProcessorIdx = pipelineBuilder.numColorFragmentProcessors();
|
||||
}
|
||||
|
||||
if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) {
|
||||
*firstCoverageProcessorIdx = pipelineBuilder.numCoverageFragmentProcessors();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -224,8 +215,7 @@ bool GrPipeline::AreEqual(const GrPipeline& a, const GrPipeline& b) {
|
||||
!a.fWindowRectsState.cheapEqualTo(b.fWindowRectsState) ||
|
||||
a.fFlags != b.fFlags ||
|
||||
a.fUserStencilSettings != b.fUserStencilSettings ||
|
||||
a.fDrawFace != b.fDrawFace ||
|
||||
a.fIgnoresCoverage != b.fIgnoresCoverage) {
|
||||
a.fDrawFace != b.fDrawFace) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -199,10 +199,6 @@ public:
|
||||
GrDrawFace getDrawFace() const { return fDrawFace; }
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool ignoresCoverage() const { return fIgnoresCoverage; }
|
||||
|
||||
private:
|
||||
GrPipeline() { /** Initialized in factory function*/ }
|
||||
|
||||
@ -246,7 +242,6 @@ private:
|
||||
uint32_t fFlags;
|
||||
ProgramXferProcessor fXferProcessor;
|
||||
FragmentProcessorArray fFragmentProcessors;
|
||||
bool fIgnoresCoverage;
|
||||
|
||||
// This value is also the index in fFragmentProcessors where coverage processors begin.
|
||||
int fNumColorProcessors;
|
||||
|
@ -59,10 +59,6 @@ public:
|
||||
/** Does the pipeline require the GrPrimitiveProcessor's color? */
|
||||
bool readsColor() const { return SkToBool(kReadsColor_Flag & fFlags); }
|
||||
|
||||
/** Does the pipeline require the GrPrimitiveProcessor's coverage? */
|
||||
bool readsCoverage() const { return
|
||||
SkToBool(kReadsCoverage_Flag & fFlags); }
|
||||
|
||||
/** Does the pipeline require access to (implicit or explicit) local coordinates? */
|
||||
bool readsLocalCoords() const {
|
||||
return SkToBool(kReadsLocalCoords_Flag & fFlags);
|
||||
@ -103,23 +99,20 @@ public:
|
||||
private:
|
||||
enum {
|
||||
// If this is not set the primitive processor need not produce a color output
|
||||
kReadsColor_Flag = 0x1,
|
||||
|
||||
// If this is not set the primitive processor need not produce a coverage output
|
||||
kReadsCoverage_Flag = 0x2,
|
||||
kReadsColor_Flag = 0x1,
|
||||
|
||||
// If this is not set the primitive processor need not produce local coordinates
|
||||
kReadsLocalCoords_Flag = 0x4,
|
||||
kReadsLocalCoords_Flag = 0x2,
|
||||
|
||||
// If this flag is set then the primitive processor may produce color*coverage as
|
||||
// its color output (and not output a separate coverage).
|
||||
kCanTweakAlphaForCoverage_Flag = 0x8,
|
||||
kCanTweakAlphaForCoverage_Flag = 0x4,
|
||||
|
||||
// If this flag is set the GrPrimitiveProcessor must produce fOverrideColor as its
|
||||
// output color. If not set fOverrideColor is to be ignored.
|
||||
kUseOverrideColor_Flag = 0x10,
|
||||
kUseOverrideColor_Flag = 0x8,
|
||||
|
||||
kWillColorBlendWithDst_Flag = 0x20,
|
||||
kWillColorBlendWithDst_Flag = 0x10,
|
||||
};
|
||||
|
||||
uint32_t fFlags;
|
||||
|
@ -214,8 +214,6 @@ bool GrProgramDesc::Build(GrProgramDesc* desc,
|
||||
|
||||
header->fOutputSwizzle = shaderCaps.configOutputSwizzle(rt->config()).asKey();
|
||||
|
||||
header->fIgnoresCoverage = pipeline.ignoresCoverage() ? 1 : 0;
|
||||
|
||||
header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
|
||||
header->fColorFragmentProcessorCnt = pipeline.numColorFragmentProcessors();
|
||||
header->fCoverageFragmentProcessorCnt = pipeline.numCoverageFragmentProcessors();
|
||||
|
@ -103,10 +103,9 @@ public:
|
||||
uint8_t fCoverageFragmentProcessorCnt : 4;
|
||||
// Set to uniquely identify the rt's origin, or 0 if the shader does not require this info.
|
||||
uint8_t fSurfaceOriginKey : 2;
|
||||
uint8_t fIgnoresCoverage : 1;
|
||||
uint8_t fSnapVerticesToPixelCenters : 1;
|
||||
uint8_t fHasPointSize : 1;
|
||||
uint8_t fPad : 3;
|
||||
uint8_t fPad : 4;
|
||||
};
|
||||
GR_STATIC_ASSERT(sizeof(KeyHeader) == 4);
|
||||
|
||||
|
@ -37,14 +37,6 @@ GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(const GrPipelineAnal
|
||||
const GrCaps& caps) const {
|
||||
GrXferProcessor::OptFlags flags =
|
||||
this->onGetOptimizations(analysis, doesStencilWrite, overrideColor, caps);
|
||||
|
||||
if (this->willReadDstColor()) {
|
||||
// When performing a dst read we handle coverage in the base class.
|
||||
SkASSERT(!(flags & GrXferProcessor::kIgnoreCoverage_OptFlag));
|
||||
if (analysis.fCoveragePOI.isSolidWhite()) {
|
||||
flags |= GrXferProcessor::kIgnoreCoverage_OptFlag;
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@ -153,12 +153,8 @@ private:
|
||||
|
||||
// Apply coverage by multiplying it into the src color before blending. Mixed samples will
|
||||
// "just work" automatically. (See onGetOptimizations())
|
||||
if (args.fInputCoverage) {
|
||||
fragBuilder->codeAppendf("%s = %s * %s;",
|
||||
args.fOutputPrimary, args.fInputCoverage, args.fInputColor);
|
||||
} else {
|
||||
fragBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, args.fInputColor);
|
||||
}
|
||||
fragBuilder->codeAppendf("%s = %s * %s;", args.fOutputPrimary, args.fInputCoverage,
|
||||
args.fInputColor);
|
||||
}
|
||||
|
||||
void emitBlendCodeForDstRead(GrGLSLXPFragmentBuilder* fragBuilder,
|
||||
@ -306,9 +302,6 @@ GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrPipelineAnalysis&
|
||||
if (analysis.fColorPOI.allStagesMultiplyInput()) {
|
||||
flags |= kCanTweakAlphaForCoverage_OptFlag;
|
||||
}
|
||||
if (this->hasHWBlendEquation() && analysis.fCoveragePOI.isSolidWhite()) {
|
||||
flags |= kIgnoreCoverage_OptFlag;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ private:
|
||||
bool doesStencilWrite,
|
||||
GrColor* color,
|
||||
const GrCaps& caps) const override {
|
||||
return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreCoverage_OptFlag;
|
||||
return GrXferProcessor::kIgnoreColor_OptFlag;
|
||||
}
|
||||
|
||||
void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
|
||||
|
@ -386,45 +386,27 @@ static void append_color_output(const PorterDuffXferProcessor& xp,
|
||||
GrGLSLXPFragmentBuilder* fragBuilder,
|
||||
BlendFormula::OutputType outputType, const char* output,
|
||||
const char* inColor, const char* inCoverage) {
|
||||
SkASSERT(inCoverage);
|
||||
SkASSERT(inColor);
|
||||
switch (outputType) {
|
||||
case BlendFormula::kNone_OutputType:
|
||||
fragBuilder->codeAppendf("%s = vec4(0.0);", output);
|
||||
break;
|
||||
case BlendFormula::kCoverage_OutputType:
|
||||
// We can have a coverage formula while not reading coverage if there are mixed samples.
|
||||
if (inCoverage) {
|
||||
fragBuilder->codeAppendf("%s = %s;", output, inCoverage);
|
||||
} else {
|
||||
fragBuilder->codeAppendf("%s = vec4(1.0);", output);
|
||||
}
|
||||
fragBuilder->codeAppendf("%s = %s;", output, inCoverage);
|
||||
break;
|
||||
case BlendFormula::kModulate_OutputType:
|
||||
if (inCoverage) {
|
||||
fragBuilder->codeAppendf("%s = %s * %s;", output, inColor, inCoverage);
|
||||
} else {
|
||||
fragBuilder->codeAppendf("%s = %s;", output, inColor);
|
||||
}
|
||||
fragBuilder->codeAppendf("%s = %s * %s;", output, inColor, inCoverage);
|
||||
break;
|
||||
case BlendFormula::kSAModulate_OutputType:
|
||||
if (inCoverage) {
|
||||
fragBuilder->codeAppendf("%s = %s.a * %s;", output, inColor, inCoverage);
|
||||
} else {
|
||||
fragBuilder->codeAppendf("%s = %s;", output, inColor);
|
||||
}
|
||||
fragBuilder->codeAppendf("%s = %s.a * %s;", output, inColor, inCoverage);
|
||||
break;
|
||||
case BlendFormula::kISAModulate_OutputType:
|
||||
if (inCoverage) {
|
||||
fragBuilder->codeAppendf("%s = (1.0 - %s.a) * %s;", output, inColor, inCoverage);
|
||||
} else {
|
||||
fragBuilder->codeAppendf("%s = vec4(1.0 - %s.a);", output, inColor);
|
||||
}
|
||||
fragBuilder->codeAppendf("%s = (1.0 - %s.a) * %s;", output, inColor, inCoverage);
|
||||
break;
|
||||
case BlendFormula::kISCModulate_OutputType:
|
||||
if (inCoverage) {
|
||||
fragBuilder->codeAppendf("%s = (vec4(1.0) - %s) * %s;", output, inColor, inCoverage);
|
||||
} else {
|
||||
fragBuilder->codeAppendf("%s = vec4(1.0) - %s;", output, inColor);
|
||||
}
|
||||
fragBuilder->codeAppendf("%s = (vec4(1.0) - %s) * %s;", output, inColor, inCoverage);
|
||||
break;
|
||||
default:
|
||||
SkFAIL("Unsupported output type.");
|
||||
@ -482,15 +464,11 @@ GrXferProcessor::OptFlags PorterDuffXferProcessor::onGetOptimizations(
|
||||
optFlags |= GrXferProcessor::kSkipDraw_OptFlag;
|
||||
}
|
||||
optFlags |= (GrXferProcessor::kIgnoreColor_OptFlag |
|
||||
GrXferProcessor::kIgnoreCoverage_OptFlag |
|
||||
GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag);
|
||||
} else {
|
||||
if (!fBlendFormula.usesInputColor()) {
|
||||
optFlags |= GrXferProcessor::kIgnoreColor_OptFlag;
|
||||
}
|
||||
if (analysis.fCoveragePOI.isSolidWhite()) {
|
||||
optFlags |= GrXferProcessor::kIgnoreCoverage_OptFlag;
|
||||
}
|
||||
if (analysis.fColorPOI.allStagesMultiplyInput() &&
|
||||
fBlendFormula.canTweakAlphaForCoverage() &&
|
||||
!analysis.fCoveragePOI.isFourChannelOutput()) {
|
||||
|
@ -65,8 +65,7 @@ bool GrGLSLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor,
|
||||
if (primProc.getPixelLocalStorageState() !=
|
||||
GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) {
|
||||
this->emitAndInstallXferProc(this->pipeline().getXferProcessor(), *inputColor,
|
||||
*inputCoverage, this->pipeline().ignoresCoverage(),
|
||||
primProc.getPixelLocalStorageState());
|
||||
*inputCoverage, primProc.getPixelLocalStorageState());
|
||||
this->emitFSOutputSwizzle(this->pipeline().getXferProcessor().hasSecondaryOutput());
|
||||
}
|
||||
|
||||
@ -206,7 +205,6 @@ void GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor& fp,
|
||||
void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp,
|
||||
const GrGLSLExpr4& colorIn,
|
||||
const GrGLSLExpr4& coverageIn,
|
||||
bool ignoresCoverage,
|
||||
GrPixelLocalStorageState plsState) {
|
||||
// Program builders have a bit of state we need to clear with each effect
|
||||
AutoStageAdvance adv(this);
|
||||
@ -237,7 +235,7 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp,
|
||||
this->uniformHandler(),
|
||||
this->shaderCaps(),
|
||||
xp, colorIn.c_str(),
|
||||
ignoresCoverage ? nullptr : coverageIn.c_str(),
|
||||
coverageIn.c_str(),
|
||||
fFS.getPrimaryColorOutputName(),
|
||||
fFS.getSecondaryColorOutputName(),
|
||||
texSamplers.begin(),
|
||||
|
@ -159,7 +159,6 @@ private:
|
||||
void emitAndInstallXferProc(const GrXferProcessor&,
|
||||
const GrGLSLExpr4& colorIn,
|
||||
const GrGLSLExpr4& coverageIn,
|
||||
bool ignoresCoverage,
|
||||
GrPixelLocalStorageState plsState);
|
||||
void emitSamplersAndImageStorages(const GrProcessor& processor,
|
||||
SkTArray<SamplerHandle>* outTexSamplerHandles,
|
||||
|
@ -354,8 +354,7 @@ void GLSLInstanceProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
}
|
||||
SkASSERT(!(usedShapeDefinitions & (kRect_ShapeFlag | kComplexRRect_ShapeFlag)));
|
||||
|
||||
backend->emitCode(v, f, pipeline.ignoresCoverage() ? nullptr : args.fOutputCoverage,
|
||||
args.fOutputColor);
|
||||
backend->emitCode(v, f, args.fOutputCoverage, args.fOutputColor);
|
||||
|
||||
const char* localCoords = nullptr;
|
||||
if (ip.opInfo().fUsesLocalCoords) {
|
||||
|
@ -712,24 +712,18 @@ static void extract_verts(const GrAAConvexTessellator& tess,
|
||||
|
||||
static sk_sp<GrGeometryProcessor> create_fill_gp(bool tweakAlphaForCoverage,
|
||||
const SkMatrix& viewMatrix,
|
||||
bool usesLocalCoords,
|
||||
bool coverageIgnored) {
|
||||
bool usesLocalCoords) {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
|
||||
Color color(Color::kAttribute_Type);
|
||||
Coverage::Type coverageType;
|
||||
// TODO remove coverage if coverage is ignored
|
||||
/*if (coverageIgnored) {
|
||||
coverageType = Coverage::kNone_Type;
|
||||
} else*/ if (tweakAlphaForCoverage) {
|
||||
if (tweakAlphaForCoverage) {
|
||||
coverageType = Coverage::kSolid_Type;
|
||||
} else {
|
||||
coverageType = Coverage::kAttribute_Type;
|
||||
}
|
||||
Coverage coverage(coverageType);
|
||||
LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type :
|
||||
LocalCoords::kUnused_Type);
|
||||
return MakeForDeviceSpace(color, coverage, localCoords, viewMatrix);
|
||||
LocalCoords::Type localCoordsType =
|
||||
usesLocalCoords ? LocalCoords::kUsePosition_Type : LocalCoords::kUnused_Type;
|
||||
return MakeForDeviceSpace(Color::kAttribute_Type, coverageType, localCoordsType, viewMatrix);
|
||||
}
|
||||
|
||||
class AAConvexPathOp final : public GrMeshDrawOp {
|
||||
@ -769,7 +763,6 @@ private:
|
||||
optimizations.getOverrideColorIfSet(&fColor);
|
||||
|
||||
fUsesLocalCoords = optimizations.readsLocalCoords();
|
||||
fCoverageIgnored = !optimizations.readsCoverage();
|
||||
fLinesOnly = SkPath::kLine_SegmentMask == fPaths[0].fPath.getSegmentMasks();
|
||||
fCanTweakAlphaForCoverage = optimizations.canTweakAlphaForCoverage();
|
||||
}
|
||||
@ -778,10 +771,8 @@ private:
|
||||
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
|
||||
|
||||
// Setup GrGeometryProcessor
|
||||
sk_sp<GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaForCoverage,
|
||||
this->viewMatrix(),
|
||||
this->usesLocalCoords(),
|
||||
this->coverageIgnored()));
|
||||
sk_sp<GrGeometryProcessor> gp(create_fill_gp(
|
||||
canTweakAlphaForCoverage, this->viewMatrix(), this->usesLocalCoords()));
|
||||
if (!gp) {
|
||||
SkDebugf("Could not create GrGeometryProcessor\n");
|
||||
return;
|
||||
@ -963,11 +954,9 @@ private:
|
||||
bool usesLocalCoords() const { return fUsesLocalCoords; }
|
||||
bool canTweakAlphaForCoverage() const { return fCanTweakAlphaForCoverage; }
|
||||
const SkMatrix& viewMatrix() const { return fPaths[0].fViewMatrix; }
|
||||
bool coverageIgnored() const { return fCoverageIgnored; }
|
||||
|
||||
GrColor fColor;
|
||||
bool fUsesLocalCoords;
|
||||
bool fCoverageIgnored;
|
||||
bool fLinesOnly;
|
||||
bool fCanTweakAlphaForCoverage;
|
||||
|
||||
|
@ -177,7 +177,6 @@ private:
|
||||
|
||||
fColorIgnored = !optimizations.readsColor();
|
||||
fUsesLocalCoords = optimizations.readsLocalCoords();
|
||||
fCoverageIgnored = !optimizations.readsCoverage();
|
||||
}
|
||||
|
||||
struct FlushInfo {
|
||||
@ -488,7 +487,6 @@ private:
|
||||
SkMatrix fViewMatrix;
|
||||
bool fUsesLocalCoords;
|
||||
bool fColorIgnored;
|
||||
bool fCoverageIgnored;
|
||||
|
||||
struct Entry {
|
||||
GrColor fColor;
|
||||
|
@ -220,11 +220,10 @@ private:
|
||||
} else {
|
||||
coverageType = Coverage::kAttribute_Type;
|
||||
}
|
||||
Coverage coverage(coverageType);
|
||||
LocalCoords lc =
|
||||
needLocalCoords ? LocalCoords::kHasExplicit_Type : LocalCoords::kUnused_Type;
|
||||
sk_sp<GrGeometryProcessor> gp =
|
||||
GrDefaultGeoProcFactory::Make(color, coverage, lc, SkMatrix::I());
|
||||
GrDefaultGeoProcFactory::Make(color, coverageType, lc, SkMatrix::I());
|
||||
if (!gp) {
|
||||
SkDebugf("Couldn't create GrGeometryProcessor\n");
|
||||
return;
|
||||
|
@ -840,11 +840,10 @@ void AAHairlineOp::onPrepareDraws(Target* target) const {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
|
||||
Color color(this->color());
|
||||
Coverage coverage(Coverage::kAttribute_Type);
|
||||
LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUsePosition_Type :
|
||||
LocalCoords::kUnused_Type);
|
||||
localCoords.fMatrix = geometryProcessorLocalM;
|
||||
lineGP = GrDefaultGeoProcFactory::Make(color, coverage, localCoords,
|
||||
lineGP = GrDefaultGeoProcFactory::Make(color, Coverage::kAttribute_Type, localCoords,
|
||||
*geometryProcessorViewM);
|
||||
}
|
||||
|
||||
|
@ -103,24 +103,18 @@ static void extract_verts(const GrAAConvexTessellator& tess,
|
||||
|
||||
static sk_sp<GrGeometryProcessor> create_fill_gp(bool tweakAlphaForCoverage,
|
||||
const SkMatrix& viewMatrix,
|
||||
bool usesLocalCoords,
|
||||
bool coverageIgnored) {
|
||||
bool usesLocalCoords) {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
|
||||
Color color(Color::kAttribute_Type);
|
||||
Coverage::Type coverageType;
|
||||
// TODO remove coverage if coverage is ignored
|
||||
/*if (coverageIgnored) {
|
||||
coverageType = Coverage::kNone_Type;
|
||||
} else*/ if (tweakAlphaForCoverage) {
|
||||
if (tweakAlphaForCoverage) {
|
||||
coverageType = Coverage::kSolid_Type;
|
||||
} else {
|
||||
coverageType = Coverage::kAttribute_Type;
|
||||
}
|
||||
Coverage coverage(coverageType);
|
||||
LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type :
|
||||
LocalCoords::kUnused_Type);
|
||||
return MakeForDeviceSpace(color, coverage, localCoords, viewMatrix);
|
||||
LocalCoords::Type localCoordsType =
|
||||
usesLocalCoords ? LocalCoords::kUsePosition_Type : LocalCoords::kUnused_Type;
|
||||
return MakeForDeviceSpace(Color::kAttribute_Type, coverageType, localCoordsType, viewMatrix);
|
||||
}
|
||||
|
||||
class AAFlatteningConvexPathOp final : public GrMeshDrawOp {
|
||||
@ -191,7 +185,6 @@ private:
|
||||
|
||||
fColor = fPaths[0].fColor;
|
||||
fUsesLocalCoords = optimizations.readsLocalCoords();
|
||||
fCoverageIgnored = !optimizations.readsCoverage();
|
||||
fCanTweakAlphaForCoverage = optimizations.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
@ -228,10 +221,8 @@ private:
|
||||
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
|
||||
|
||||
// Setup GrGeometryProcessor
|
||||
sk_sp<GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaForCoverage,
|
||||
this->viewMatrix(),
|
||||
this->usesLocalCoords(),
|
||||
this->coverageIgnored()));
|
||||
sk_sp<GrGeometryProcessor> gp(create_fill_gp(
|
||||
canTweakAlphaForCoverage, this->viewMatrix(), this->usesLocalCoords()));
|
||||
if (!gp) {
|
||||
SkDebugf("Couldn't create a GrGeometryProcessor\n");
|
||||
return;
|
||||
@ -317,7 +308,6 @@ private:
|
||||
bool usesLocalCoords() const { return fUsesLocalCoords; }
|
||||
bool canTweakAlphaForCoverage() const { return fCanTweakAlphaForCoverage; }
|
||||
const SkMatrix& viewMatrix() const { return fPaths[0].fViewMatrix; }
|
||||
bool coverageIgnored() const { return fCoverageIgnored; }
|
||||
|
||||
struct PathData {
|
||||
GrColor fColor;
|
||||
@ -331,7 +321,6 @@ private:
|
||||
|
||||
GrColor fColor;
|
||||
bool fUsesLocalCoords;
|
||||
bool fCoverageIgnored;
|
||||
bool fCanTweakAlphaForCoverage;
|
||||
SkSTArray<1, PathData, true> fPaths;
|
||||
|
||||
|
@ -97,17 +97,15 @@ static sk_sp<GrGeometryProcessor> create_stroke_rect_gp(bool tweakAlphaForCovera
|
||||
bool usesLocalCoords) {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
|
||||
Color color(Color::kAttribute_Type);
|
||||
Coverage::Type coverageType;
|
||||
if (tweakAlphaForCoverage) {
|
||||
coverageType = Coverage::kSolid_Type;
|
||||
} else {
|
||||
coverageType = Coverage::kAttribute_Type;
|
||||
}
|
||||
Coverage coverage(coverageType);
|
||||
LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type
|
||||
: LocalCoords::kUnused_Type);
|
||||
return MakeForDeviceSpace(color, coverage, localCoords, viewMatrix);
|
||||
LocalCoords::Type localCoordsType =
|
||||
usesLocalCoords ? LocalCoords::kUsePosition_Type : LocalCoords::kUnused_Type;
|
||||
return MakeForDeviceSpace(Color::kAttribute_Type, coverageType, localCoordsType, viewMatrix);
|
||||
}
|
||||
|
||||
class AAStrokeRectOp final : public GrMeshDrawOp {
|
||||
|
@ -75,7 +75,6 @@ void GrAtlasTextOp::applyPipelineOptimizations(const GrPipelineOptimizations& op
|
||||
fColorIgnored = !optimizations.readsColor();
|
||||
fColor = fGeoData[0].fColor;
|
||||
fUsesLocalCoords = optimizations.readsLocalCoords();
|
||||
fCoverageIgnored = !optimizations.readsCoverage();
|
||||
}
|
||||
|
||||
void GrAtlasTextOp::onPrepareDraws(Target* target) const {
|
||||
|
@ -154,7 +154,6 @@ private:
|
||||
GrColor fColor;
|
||||
bool fUsesLocalCoords;
|
||||
bool fColorIgnored;
|
||||
bool fCoverageIgnored;
|
||||
int fNumGlyphs;
|
||||
|
||||
// The minimum number of Geometry we will try to allocate.
|
||||
|
@ -309,7 +309,6 @@ private:
|
||||
optimizations.getOverrideColorIfSet(&fColor);
|
||||
|
||||
fUsesLocalCoords = optimizations.readsLocalCoords();
|
||||
fCoverageIgnored = !optimizations.readsCoverage();
|
||||
}
|
||||
|
||||
struct DashDraw {
|
||||
@ -346,11 +345,11 @@ private:
|
||||
// Set up the vertex data for the line and start/end dashes
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
Color color(this->color());
|
||||
Coverage coverage(this->coverageIgnored() ? Coverage::kNone_Type :
|
||||
Coverage::kSolid_Type);
|
||||
LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUsePosition_Type :
|
||||
LocalCoords::kUnused_Type);
|
||||
gp = MakeForDeviceSpace(color, coverage, localCoords, this->viewMatrix());
|
||||
LocalCoords::Type localCoordsType = this->usesLocalCoords()
|
||||
? LocalCoords::kUsePosition_Type
|
||||
: LocalCoords::kUnused_Type;
|
||||
gp = MakeForDeviceSpace(color, Coverage::kSolid_Type, localCoordsType,
|
||||
this->viewMatrix());
|
||||
}
|
||||
|
||||
if (!gp) {
|
||||
@ -672,14 +671,12 @@ private:
|
||||
AAMode aaMode() const { return fAAMode; }
|
||||
bool fullDash() const { return fFullDash; }
|
||||
SkPaint::Cap cap() const { return fCap; }
|
||||
bool coverageIgnored() const { return fCoverageIgnored; }
|
||||
|
||||
static const int kVertsPerDash = 4;
|
||||
static const int kIndicesPerDash = 6;
|
||||
|
||||
GrColor fColor;
|
||||
bool fUsesLocalCoords;
|
||||
bool fCoverageIgnored;
|
||||
SkPaint::Cap fCap;
|
||||
AAMode fAAMode;
|
||||
bool fFullDash;
|
||||
|
@ -143,7 +143,6 @@ private:
|
||||
}
|
||||
optimizations.getOverrideColorIfSet(&fColor);
|
||||
fUsesLocalCoords = optimizations.readsLocalCoords();
|
||||
fCoverageIgnored = !optimizations.readsCoverage();
|
||||
}
|
||||
|
||||
void onPrepareDraws(Target* target) const override {
|
||||
@ -152,9 +151,6 @@ private:
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
Color color(this->color());
|
||||
Coverage coverage(this->coverage());
|
||||
if (this->coverageIgnored()) {
|
||||
coverage.fType = Coverage::kNone_Type;
|
||||
}
|
||||
LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUsePosition_Type :
|
||||
LocalCoords::kUnused_Type);
|
||||
gp = GrDefaultGeoProcFactory::Make(color, coverage, localCoords, this->viewMatrix());
|
||||
@ -395,7 +391,6 @@ private:
|
||||
bool usesLocalCoords() const { return fUsesLocalCoords; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
bool isHairline() const { return fIsHairline; }
|
||||
bool coverageIgnored() const { return fCoverageIgnored; }
|
||||
|
||||
struct PathData {
|
||||
SkPath fPath;
|
||||
@ -406,7 +401,6 @@ private:
|
||||
uint8_t fCoverage;
|
||||
SkMatrix fViewMatrix;
|
||||
bool fUsesLocalCoords;
|
||||
bool fCoverageIgnored;
|
||||
bool fIsHairline;
|
||||
SkSTArray<1, PathData, true> fPaths;
|
||||
|
||||
|
@ -31,28 +31,24 @@ void GrDrawAtlasOp::applyPipelineOptimizations(const GrPipelineOptimizations& op
|
||||
fColor = fGeoData[0].fColor;
|
||||
// We'd like to assert this, but we can't because of GLPrograms test
|
||||
// SkASSERT(init.readsLocalCoords());
|
||||
fCoverageIgnored = !optimizations.readsCoverage();
|
||||
}
|
||||
|
||||
static sk_sp<GrGeometryProcessor> set_vertex_attributes(bool hasColors,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
bool coverageIgnored) {
|
||||
static sk_sp<GrGeometryProcessor> make_gp(bool hasColors,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix) {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
Color gpColor(color);
|
||||
if (hasColors) {
|
||||
gpColor.fType = Color::kAttribute_Type;
|
||||
}
|
||||
|
||||
Coverage coverage(coverageIgnored ? Coverage::kNone_Type : Coverage::kSolid_Type);
|
||||
LocalCoords localCoords(LocalCoords::kHasExplicit_Type);
|
||||
return GrDefaultGeoProcFactory::Make(gpColor, coverage, localCoords, viewMatrix);
|
||||
return GrDefaultGeoProcFactory::Make(gpColor, Coverage::kSolid_Type,
|
||||
LocalCoords::kHasExplicit_Type, viewMatrix);
|
||||
}
|
||||
|
||||
void GrDrawAtlasOp::onPrepareDraws(Target* target) const {
|
||||
// Setup geometry processor
|
||||
sk_sp<GrGeometryProcessor> gp(set_vertex_attributes(
|
||||
this->hasColors(), this->color(), this->viewMatrix(), this->coverageIgnored()));
|
||||
sk_sp<GrGeometryProcessor> gp(make_gp(this->hasColors(), this->color(), this->viewMatrix()));
|
||||
|
||||
int instanceCount = fGeoData.count();
|
||||
size_t vertexStride = gp->getVertexStride();
|
||||
|
@ -57,7 +57,6 @@ private:
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
bool hasColors() const { return fHasColors; }
|
||||
int quadCount() const { return fQuadCount; }
|
||||
bool coverageIgnored() const { return fCoverageIgnored; }
|
||||
|
||||
bool onCombineIfPossible(GrOp* t, const GrCaps&) override;
|
||||
|
||||
@ -72,7 +71,6 @@ private:
|
||||
GrColor fColor;
|
||||
int fQuadCount;
|
||||
bool fColorIgnored;
|
||||
bool fCoverageIgnored;
|
||||
bool fHasColors;
|
||||
|
||||
typedef GrMeshDrawOp INHERITED;
|
||||
|
@ -14,21 +14,19 @@
|
||||
static sk_sp<GrGeometryProcessor> set_vertex_attributes(bool hasLocalCoords,
|
||||
int* colorOffset,
|
||||
int* texOffset,
|
||||
const SkMatrix& viewMatrix,
|
||||
bool coverageIgnored) {
|
||||
const SkMatrix& viewMatrix) {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
*texOffset = -1;
|
||||
*colorOffset = -1;
|
||||
|
||||
Coverage coverage(coverageIgnored ? Coverage::kNone_Type : Coverage::kSolid_Type);
|
||||
LocalCoords localCoords(hasLocalCoords ? LocalCoords::kHasExplicit_Type
|
||||
: LocalCoords::kUsePosition_Type);
|
||||
LocalCoords::Type localCoordsType =
|
||||
hasLocalCoords ? LocalCoords::kHasExplicit_Type : LocalCoords::kUsePosition_Type;
|
||||
*colorOffset = sizeof(SkPoint);
|
||||
if (hasLocalCoords) {
|
||||
*texOffset = sizeof(SkPoint) + sizeof(GrColor);
|
||||
}
|
||||
return GrDefaultGeoProcFactory::Make(Color(Color::kAttribute_Type), coverage, localCoords,
|
||||
viewMatrix);
|
||||
return GrDefaultGeoProcFactory::Make(Color::kAttribute_Type, Coverage::kSolid_Type,
|
||||
localCoordsType, viewMatrix);
|
||||
}
|
||||
|
||||
GrDrawVerticesOp::GrDrawVerticesOp(GrColor color, GrPrimitiveType primitiveType,
|
||||
@ -88,7 +86,6 @@ void GrDrawVerticesOp::applyPipelineOptimizations(const GrPipelineOptimizations&
|
||||
fMeshes[0].fColors.reset();
|
||||
fVariableColor = false;
|
||||
}
|
||||
fCoverageIgnored = !optimizations.readsCoverage();
|
||||
if (!optimizations.readsLocalCoords()) {
|
||||
fMeshes[0].fLocalCoords.reset();
|
||||
}
|
||||
@ -97,8 +94,8 @@ void GrDrawVerticesOp::applyPipelineOptimizations(const GrPipelineOptimizations&
|
||||
void GrDrawVerticesOp::onPrepareDraws(Target* target) const {
|
||||
bool hasLocalCoords = !fMeshes[0].fLocalCoords.isEmpty();
|
||||
int colorOffset = -1, texOffset = -1;
|
||||
sk_sp<GrGeometryProcessor> gp(set_vertex_attributes(hasLocalCoords, &colorOffset, &texOffset,
|
||||
fViewMatrix, fCoverageIgnored));
|
||||
sk_sp<GrGeometryProcessor> gp(
|
||||
set_vertex_attributes(hasLocalCoords, &colorOffset, &texOffset, fViewMatrix));
|
||||
size_t vertexStride = gp->getVertexStride();
|
||||
|
||||
SkASSERT(vertexStride ==
|
||||
|
@ -75,7 +75,6 @@ private:
|
||||
bool fVariableColor;
|
||||
int fVertexCount;
|
||||
int fIndexCount;
|
||||
bool fCoverageIgnored; // comes from applyPipelineOptimizations.
|
||||
|
||||
SkSTArray<1, Mesh, true> fMeshes;
|
||||
|
||||
|
@ -15,12 +15,10 @@
|
||||
#include "SkLatticeIter.h"
|
||||
#include "SkRect.h"
|
||||
|
||||
static sk_sp<GrGeometryProcessor> create_gp(bool readsCoverage) {
|
||||
static sk_sp<GrGeometryProcessor> create_gp() {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
Color color(Color::kAttribute_Type);
|
||||
Coverage coverage(readsCoverage ? Coverage::kSolid_Type : Coverage::kNone_Type);
|
||||
LocalCoords localCoords(LocalCoords::kHasExplicit_Type);
|
||||
return GrDefaultGeoProcFactory::Make(color, coverage, localCoords, SkMatrix::I());
|
||||
return GrDefaultGeoProcFactory::Make(Color::kAttribute_Type, Coverage::kSolid_Type,
|
||||
LocalCoords::kHasExplicit_Type, SkMatrix::I());
|
||||
}
|
||||
|
||||
class NonAALatticeOp final : public GrMeshDrawOp {
|
||||
@ -74,7 +72,7 @@ private:
|
||||
}
|
||||
|
||||
void onPrepareDraws(Target* target) const override {
|
||||
sk_sp<GrGeometryProcessor> gp(create_gp(fOptimizations.readsCoverage()));
|
||||
sk_sp<GrGeometryProcessor> gp(create_gp());
|
||||
if (!gp) {
|
||||
SkDebugf("Couldn't create GrGeometryProcessor\n");
|
||||
return;
|
||||
|
@ -404,7 +404,7 @@ private:
|
||||
{
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
lineGP = GrDefaultGeoProcFactory::Make(Color(Color::kAttribute_Type),
|
||||
Coverage(255),
|
||||
Coverage::kSolid_Type,
|
||||
LocalCoords(LocalCoords::kUnused_Type),
|
||||
fViewMatrix);
|
||||
}
|
||||
|
@ -28,13 +28,10 @@ static const int kIndicesPerInstance = 6;
|
||||
|
||||
The vertex attrib order is always pos, color, [local coords].
|
||||
*/
|
||||
static sk_sp<GrGeometryProcessor> make_gp(bool readsCoverage) {
|
||||
static sk_sp<GrGeometryProcessor> make_gp() {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
Color color(Color::kAttribute_Type);
|
||||
Coverage coverage(readsCoverage ? Coverage::kSolid_Type : Coverage::kNone_Type);
|
||||
|
||||
LocalCoords localCoords(LocalCoords::kHasExplicit_Type);
|
||||
return GrDefaultGeoProcFactory::Make(color, coverage, localCoords, SkMatrix::I());
|
||||
return GrDefaultGeoProcFactory::Make(Color::kAttribute_Type, Coverage::kSolid_Type,
|
||||
LocalCoords::kHasExplicit_Type, SkMatrix::I());
|
||||
}
|
||||
|
||||
static void tesselate(intptr_t vertices,
|
||||
@ -124,7 +121,7 @@ private:
|
||||
}
|
||||
|
||||
void onPrepareDraws(Target* target) const override {
|
||||
sk_sp<GrGeometryProcessor> gp = make_gp(fOptimizations.readsCoverage());
|
||||
sk_sp<GrGeometryProcessor> gp = make_gp();
|
||||
if (!gp) {
|
||||
SkDebugf("Couldn't create GrGeometryProcessor\n");
|
||||
return;
|
||||
|
@ -27,14 +27,11 @@ static const int kIndicesPerInstance = 6;
|
||||
The vertex attrib order is always pos, color, [local coords].
|
||||
*/
|
||||
static sk_sp<GrGeometryProcessor> make_persp_gp(const SkMatrix& viewMatrix,
|
||||
bool readsCoverage,
|
||||
bool hasExplicitLocalCoords,
|
||||
const SkMatrix* localMatrix) {
|
||||
SkASSERT(viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspective()));
|
||||
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
Color color(Color::kAttribute_Type);
|
||||
Coverage coverage(readsCoverage ? Coverage::kSolid_Type : Coverage::kNone_Type);
|
||||
|
||||
// If we have perspective on the viewMatrix then we won't map on the CPU, nor will we map
|
||||
// the local rect on the cpu (in case the localMatrix also has perspective).
|
||||
@ -44,14 +41,16 @@ static sk_sp<GrGeometryProcessor> make_persp_gp(const SkMatrix& viewMatrix,
|
||||
LocalCoords localCoords(hasExplicitLocalCoords ? LocalCoords::kHasExplicit_Type
|
||||
: LocalCoords::kUsePosition_Type,
|
||||
localMatrix);
|
||||
return GrDefaultGeoProcFactory::Make(color, coverage, localCoords, viewMatrix);
|
||||
return GrDefaultGeoProcFactory::Make(Color::kAttribute_Type, Coverage::kSolid_Type,
|
||||
localCoords, viewMatrix);
|
||||
} else if (hasExplicitLocalCoords) {
|
||||
LocalCoords localCoords(LocalCoords::kHasExplicit_Type, localMatrix);
|
||||
return GrDefaultGeoProcFactory::Make(color, coverage, localCoords, SkMatrix::I());
|
||||
return GrDefaultGeoProcFactory::Make(Color::kAttribute_Type, Coverage::kSolid_Type,
|
||||
localCoords, SkMatrix::I());
|
||||
} else {
|
||||
LocalCoords localCoords(LocalCoords::kUsePosition_Type, localMatrix);
|
||||
return GrDefaultGeoProcFactory::MakeForDeviceSpace(color, coverage, localCoords,
|
||||
viewMatrix);
|
||||
return GrDefaultGeoProcFactory::MakeForDeviceSpace(
|
||||
Color::kAttribute_Type, Coverage::kSolid_Type, localCoords, viewMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,7 +141,6 @@ private:
|
||||
|
||||
void onPrepareDraws(Target* target) const override {
|
||||
sk_sp<GrGeometryProcessor> gp = make_persp_gp(fViewMatrix,
|
||||
fOptimizations.readsCoverage(),
|
||||
fHasLocalRect,
|
||||
fHasLocalMatrix ? &fLocalMatrix : nullptr);
|
||||
if (!gp) {
|
||||
|
@ -111,12 +111,11 @@ private:
|
||||
{
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
Color color(fColor);
|
||||
Coverage coverage(fOptimizations.readsCoverage() ? Coverage::kSolid_Type
|
||||
: Coverage::kNone_Type);
|
||||
LocalCoords localCoords(fOptimizations.readsLocalCoords()
|
||||
? LocalCoords::kUsePosition_Type
|
||||
: LocalCoords::kUnused_Type);
|
||||
gp = GrDefaultGeoProcFactory::Make(color, coverage, localCoords, fViewMatrix);
|
||||
LocalCoords::Type localCoordsType = fOptimizations.readsLocalCoords()
|
||||
? LocalCoords::kUsePosition_Type
|
||||
: LocalCoords::kUnused_Type;
|
||||
gp = GrDefaultGeoProcFactory::Make(color, Coverage::kSolid_Type, localCoordsType,
|
||||
fViewMatrix);
|
||||
}
|
||||
|
||||
size_t vertexStride = gp->getVertexStride();
|
||||
|
@ -1251,7 +1251,7 @@ private:
|
||||
}
|
||||
|
||||
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
|
||||
if (!optimizations.readsCoverage()) {
|
||||
if (!optimizations.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
if (!optimizations.readsLocalCoords()) {
|
||||
|
@ -17,13 +17,10 @@
|
||||
static const int kVertsPerInstance = 4;
|
||||
static const int kIndicesPerInstance = 6;
|
||||
|
||||
static sk_sp<GrGeometryProcessor> make_gp(bool readsCoverage, const SkMatrix& viewMatrix) {
|
||||
static sk_sp<GrGeometryProcessor> make_gp(const SkMatrix& viewMatrix) {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
Color color(Color::kAttribute_Type);
|
||||
Coverage coverage(readsCoverage ? Coverage::kSolid_Type : Coverage::kNone_Type);
|
||||
|
||||
LocalCoords localCoords(LocalCoords::kUsePosition_Type);
|
||||
return GrDefaultGeoProcFactory::Make(color, coverage, localCoords, viewMatrix);
|
||||
return GrDefaultGeoProcFactory::Make(Color::kAttribute_Type, Coverage::kSolid_Type,
|
||||
LocalCoords::kUsePosition_Type, viewMatrix);
|
||||
}
|
||||
|
||||
static void tesselate_region(intptr_t vertices,
|
||||
@ -91,7 +88,7 @@ private:
|
||||
}
|
||||
|
||||
void onPrepareDraws(Target* target) const override {
|
||||
sk_sp<GrGeometryProcessor> gp = make_gp(fOptimizations.readsCoverage(), fViewMatrix);
|
||||
sk_sp<GrGeometryProcessor> gp = make_gp(fViewMatrix);
|
||||
if (!gp) {
|
||||
SkDebugf("Couldn't create GrGeometryProcessor\n");
|
||||
return;
|
||||
|
@ -278,9 +278,9 @@ private:
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
|
||||
Color color(fColor);
|
||||
LocalCoords localCoords(fOptimizations.readsLocalCoords()
|
||||
? LocalCoords::kUsePosition_Type
|
||||
: LocalCoords::kUnused_Type);
|
||||
LocalCoords::Type localCoordsType = fOptimizations.readsLocalCoords()
|
||||
? LocalCoords::kUsePosition_Type
|
||||
: LocalCoords::kUnused_Type;
|
||||
Coverage::Type coverageType;
|
||||
if (fAntiAlias) {
|
||||
color = Color(Color::kAttribute_Type);
|
||||
@ -289,17 +289,15 @@ private:
|
||||
} else {
|
||||
coverageType = Coverage::kAttribute_Type;
|
||||
}
|
||||
} else if (fOptimizations.readsCoverage()) {
|
||||
} else {
|
||||
coverageType = Coverage::kSolid_Type;
|
||||
} else {
|
||||
coverageType = Coverage::kNone_Type;
|
||||
}
|
||||
Coverage coverage(coverageType);
|
||||
if (fAntiAlias) {
|
||||
gp = GrDefaultGeoProcFactory::MakeForDeviceSpace(color, coverage, localCoords,
|
||||
fViewMatrix);
|
||||
gp = GrDefaultGeoProcFactory::MakeForDeviceSpace(color, coverageType,
|
||||
localCoordsType, fViewMatrix);
|
||||
} else {
|
||||
gp = GrDefaultGeoProcFactory::Make(color, coverage, localCoords, fViewMatrix);
|
||||
gp = GrDefaultGeoProcFactory::Make(color, coverageType, localCoordsType,
|
||||
fViewMatrix);
|
||||
}
|
||||
}
|
||||
if (fAntiAlias) {
|
||||
|
@ -33,7 +33,6 @@ protected:
|
||||
struct Optimizations {
|
||||
bool fColorIgnored = false;
|
||||
bool fUsesLocalCoords = false;
|
||||
bool fCoverageIgnored = false;
|
||||
};
|
||||
|
||||
const Optimizations optimizations() const { return fOptimizations; }
|
||||
@ -49,7 +48,6 @@ private:
|
||||
|
||||
fOptimizations.fColorIgnored = !optimizations.readsColor();
|
||||
fOptimizations.fUsesLocalCoords = optimizations.readsLocalCoords();
|
||||
fOptimizations.fCoverageIgnored = !optimizations.readsCoverage();
|
||||
}
|
||||
|
||||
bool onCombineIfPossible(GrOp*, const GrCaps&) override { return false; }
|
||||
|
@ -59,7 +59,6 @@ enum {
|
||||
kNone_OptFlags = GrXferProcessor::kNone_OptFlags,
|
||||
kSkipDraw_OptFlag = GrXferProcessor::kSkipDraw_OptFlag,
|
||||
kIgnoreColor_OptFlag = GrXferProcessor::kIgnoreColor_OptFlag,
|
||||
kIgnoreCoverage_OptFlag = GrXferProcessor::kIgnoreCoverage_OptFlag,
|
||||
kCanTweakAlphaForCoverage_OptFlag = GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag
|
||||
};
|
||||
|
||||
@ -136,7 +135,6 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kSkipDraw_OptFlag |
|
||||
kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
@ -326,7 +324,6 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kSkipDraw_OptFlag |
|
||||
kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
@ -496,8 +493,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor);
|
||||
TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kIgnoreColor_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -511,7 +507,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
TEST_ASSERT(154 == GrColorUnpackB(xpi.fBlendedColor.fKnownColor));
|
||||
TEST_ASSERT((kR_GrColorComponentFlag |
|
||||
kB_GrColorComponentFlag) == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -524,7 +520,6 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kSkipDraw_OptFlag |
|
||||
kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
@ -536,8 +531,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kSrcOver:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -548,8 +542,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kDstOver:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -560,7 +553,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kSrcIn:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -571,7 +564,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kDstIn:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -582,7 +575,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kSrcOut:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -593,8 +586,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kDstOut:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -605,8 +597,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kSrcATop:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -617,7 +608,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kDstATop:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -628,8 +619,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kXor:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -640,8 +630,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kPlus:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -652,7 +641,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kModulate:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -663,8 +652,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
case SkBlendMode::kScreen:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -724,7 +712,6 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kSkipDraw_OptFlag |
|
||||
kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
@ -772,7 +759,6 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kSkipDraw_OptFlag |
|
||||
kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
@ -899,8 +885,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor);
|
||||
TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kIgnoreColor_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -914,7 +899,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor));
|
||||
TEST_ASSERT((kG_GrColorComponentFlag |
|
||||
kA_GrColorComponentFlag) == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -927,7 +912,6 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kSkipDraw_OptFlag |
|
||||
kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
@ -942,7 +926,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor));
|
||||
TEST_ASSERT((kG_GrColorComponentFlag |
|
||||
kA_GrColorComponentFlag) == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -953,8 +937,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
case SkBlendMode::kDstOver:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -965,7 +948,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
case SkBlendMode::kSrcIn:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -978,7 +961,6 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kSkipDraw_OptFlag |
|
||||
kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
@ -990,7 +972,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
case SkBlendMode::kSrcOut:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -1002,8 +984,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor);
|
||||
TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreColor_OptFlag |
|
||||
kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kIgnoreColor_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -1014,7 +995,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
case SkBlendMode::kSrcATop:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -1025,8 +1006,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
case SkBlendMode::kDstATop:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -1037,7 +1017,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
case SkBlendMode::kXor:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -1048,8 +1028,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
case SkBlendMode::kPlus:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -1060,7 +1039,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
case SkBlendMode::kModulate:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -1071,8 +1050,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
case SkBlendMode::kScreen:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kIgnoreCoverage_OptFlag |
|
||||
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
|
Loading…
Reference in New Issue
Block a user