Makes GrPipelineInfo a class with query functions used by GrBatch subclasses.
Committed: https://skia.googlesource.com/skia/+/f5179a4c490bc787190321bd8ffdb0e6a4efa9ac Review URL: https://codereview.chromium.org/1213383005
This commit is contained in:
parent
c1d1dd738e
commit
7765a477ee
@ -103,10 +103,6 @@ public:
|
||||
* Optimizations for blending / coverage that an OptDrawState should apply to itself.
|
||||
*/
|
||||
enum OptFlags {
|
||||
/**
|
||||
* No optimizations needed
|
||||
*/
|
||||
kNone_Opt = 0,
|
||||
/**
|
||||
* The draw can be skipped completely.
|
||||
*/
|
||||
@ -129,6 +125,8 @@ public:
|
||||
kCanTweakAlphaForCoverage_OptFlag = 0x20,
|
||||
};
|
||||
|
||||
static const OptFlags kNone_OptFlags = (OptFlags)0;
|
||||
|
||||
GR_DECL_BITFIELD_OPS_FRIENDS(OptFlags);
|
||||
|
||||
/**
|
||||
|
@ -271,7 +271,7 @@ GrXferProcessor::OptFlags ArithmeticXP::onGetOptimizations(const GrProcOptInfo&
|
||||
bool doesStencilWrite,
|
||||
GrColor* overrideColor,
|
||||
const GrCaps& caps) {
|
||||
return GrXferProcessor::kNone_Opt;
|
||||
return GrXferProcessor::kNone_OptFlags;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -761,19 +761,18 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks();
|
||||
fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage;
|
||||
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
void generateGeometryLinesOnly(GrBatchTarget* batchTarget, const GrPipeline* pipeline) {
|
||||
|
@ -157,16 +157,15 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fBatch.fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fBatch.fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fBatch.fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
struct FlushInfo {
|
||||
|
@ -700,17 +700,16 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fCoverage = fGeoData[0].fCoverage;
|
||||
}
|
||||
|
||||
|
@ -136,19 +136,18 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks();
|
||||
fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage;
|
||||
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
void draw(GrBatchTarget* batchTarget, const GrPipeline* pipeline, int vertexCount,
|
||||
|
@ -76,18 +76,16 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
if (!init.readsColor()) {
|
||||
fBatch.fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fBatch.fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
@ -424,19 +422,18 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fMiterStroke = fGeoData[0].fMiterStroke;
|
||||
fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage;
|
||||
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
|
@ -1498,16 +1498,15 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fBatch.fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fBatch.fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fBatch.fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
struct FlushInfo {
|
||||
|
@ -24,16 +24,16 @@ public:
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix,
|
||||
bool usesLocalCoords,
|
||||
bool coverageIgnored,
|
||||
bool localCoordsWillBeRead,
|
||||
bool coverageWillBeIgnored,
|
||||
uint8_t coverage) {
|
||||
return SkNEW_ARGS(DefaultGeoProc, (gpTypeFlags,
|
||||
color,
|
||||
viewMatrix,
|
||||
localMatrix,
|
||||
coverage,
|
||||
usesLocalCoords,
|
||||
coverageIgnored));
|
||||
localCoordsWillBeRead,
|
||||
coverageWillBeIgnored));
|
||||
}
|
||||
|
||||
const char* name() const override { return "DefaultGeometryProcessor"; }
|
||||
@ -47,9 +47,9 @@ public:
|
||||
bool hasVertexColor() const { return SkToBool(fInColor); }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
const SkMatrix& localMatrix() const { return fLocalMatrix; }
|
||||
bool usesLocalCoords() const { return fUsesLocalCoords; }
|
||||
bool localCoordsWillBeRead() const { return fLocalCoordsWillBeRead; }
|
||||
uint8_t coverage() const { return fCoverage; }
|
||||
bool coverageIgnored() const { return fCoverageIgnored; }
|
||||
bool coverageWillBeIgnored() const { return fCoverageWillBeIgnored; }
|
||||
bool hasVertexCoverage() const { return SkToBool(fInCoverage); }
|
||||
|
||||
class GLProcessor : public GrGLGeometryProcessor {
|
||||
@ -90,7 +90,7 @@ public:
|
||||
}
|
||||
|
||||
// Setup coverage as pass through
|
||||
if (!gp.coverageIgnored()) {
|
||||
if (!gp.coverageWillBeIgnored()) {
|
||||
if (gp.hasVertexCoverage()) {
|
||||
fs->codeAppendf("float alpha = 1.0;");
|
||||
args.fPB->addPassThroughAttribute(gp.inCoverage(), "alpha");
|
||||
@ -116,11 +116,12 @@ public:
|
||||
const DefaultGeoProc& def = gp.cast<DefaultGeoProc>();
|
||||
uint32_t key = def.fFlags;
|
||||
key |= def.colorIgnored() << 8;
|
||||
key |= def.coverageIgnored() << 9;
|
||||
key |= def.coverageWillBeIgnored() << 9;
|
||||
key |= def.hasVertexColor() << 10;
|
||||
key |= def.hasVertexCoverage() << 11;
|
||||
key |= def.coverage() == 0xff ? 0x1 << 12 : 0;
|
||||
key |= def.usesLocalCoords() && def.localMatrix().hasPerspective() ? 0x1 << 24 : 0x0;
|
||||
key |= def.localCoordsWillBeRead() && def.localMatrix().hasPerspective() ? 0x1 << 24 :
|
||||
0x0;
|
||||
key |= ComputePosKey(def.viewMatrix()) << 25;
|
||||
b->add32(key);
|
||||
}
|
||||
@ -144,7 +145,8 @@ public:
|
||||
fColor = dgp.color();
|
||||
}
|
||||
|
||||
if (!dgp.coverageIgnored() && dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) {
|
||||
if (!dgp.coverageWillBeIgnored() &&
|
||||
dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) {
|
||||
pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(dgp.coverage()));
|
||||
fCoverage = dgp.coverage();
|
||||
}
|
||||
@ -185,8 +187,8 @@ private:
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix,
|
||||
uint8_t coverage,
|
||||
bool usesLocalCoords,
|
||||
bool coverageIgnored)
|
||||
bool localCoordsWillBeRead,
|
||||
bool coverageWillBeIgnored)
|
||||
: fInPosition(NULL)
|
||||
, fInColor(NULL)
|
||||
, fInLocalCoords(NULL)
|
||||
@ -196,8 +198,8 @@ private:
|
||||
, fLocalMatrix(localMatrix)
|
||||
, fCoverage(coverage)
|
||||
, fFlags(gpTypeFlags)
|
||||
, fUsesLocalCoords(usesLocalCoords)
|
||||
, fCoverageIgnored(coverageIgnored) {
|
||||
, fLocalCoordsWillBeRead(localCoordsWillBeRead)
|
||||
, fCoverageWillBeIgnored(coverageWillBeIgnored) {
|
||||
this->initClassID<DefaultGeoProc>();
|
||||
bool hasColor = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kColor_GPType);
|
||||
bool hasLocalCoord = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kLocalCoord_GPType);
|
||||
@ -214,7 +216,7 @@ private:
|
||||
}
|
||||
if (hasCoverage) {
|
||||
fInCoverage = &this->addVertexAttrib(Attribute("inCoverage",
|
||||
kFloat_GrVertexAttribType));
|
||||
kFloat_GrVertexAttribType));
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,8 +229,8 @@ private:
|
||||
SkMatrix fLocalMatrix;
|
||||
uint8_t fCoverage;
|
||||
uint32_t fFlags;
|
||||
bool fUsesLocalCoords;
|
||||
bool fCoverageIgnored;
|
||||
bool fLocalCoordsWillBeRead;
|
||||
bool fCoverageWillBeIgnored;
|
||||
|
||||
GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
|
||||
|
||||
@ -263,8 +265,8 @@ GrGeometryProcessor* DefaultGeoProc::TestCreate(SkRandom* random,
|
||||
|
||||
const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags,
|
||||
GrColor color,
|
||||
bool usesLocalCoords,
|
||||
bool coverageIgnored,
|
||||
bool localCoordsWillBeRead,
|
||||
bool coverageWillBeIgnored,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix,
|
||||
uint8_t coverage) {
|
||||
@ -272,7 +274,7 @@ const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags,
|
||||
color,
|
||||
viewMatrix,
|
||||
localMatrix,
|
||||
usesLocalCoords,
|
||||
coverageIgnored,
|
||||
localCoordsWillBeRead,
|
||||
coverageWillBeIgnored,
|
||||
coverage);
|
||||
}
|
||||
|
@ -74,17 +74,17 @@ public:
|
||||
};
|
||||
|
||||
/*
|
||||
* The following functions are used to create default GPs. If you just need to create
|
||||
* attributes seperately from creating the default GP, use the SetAttribs function followed
|
||||
* by the Create function. Otherwise use CreateAndSetAttribs to do both at once.
|
||||
* The following functions are used to create default GPs. If you just need to create
|
||||
* attributes separately from creating the default GP, use the SetAttribs function followed
|
||||
* by the Create function. Otherwise use CreateAndSetAttribs to do both at once.
|
||||
*
|
||||
* You must unref the return from Create.
|
||||
*/
|
||||
// TODO clean this up
|
||||
static const GrGeometryProcessor* Create(uint32_t gpTypeFlags,
|
||||
GrColor,
|
||||
bool usesLocalCoords,
|
||||
bool coverageIgnored,
|
||||
bool localCoordsWillBeRead,
|
||||
bool coverageWillBeIgnored,
|
||||
const SkMatrix& viewMatrix = SkMatrix::I(),
|
||||
const SkMatrix& localMatrix = SkMatrix::I(),
|
||||
uint8_t coverage = 0xff);
|
||||
|
@ -237,17 +237,16 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
|
@ -275,17 +275,16 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
@ -614,17 +613,16 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
|
@ -33,7 +33,7 @@ void GrImmediateDrawTarget::onDrawBatch(GrBatch* batch,
|
||||
return;
|
||||
}
|
||||
|
||||
batch->initBatchTracker(pipeline->getInitBatchTracker());
|
||||
batch->initBatchTracker(pipeline->infoForPrimitiveProcessor());
|
||||
|
||||
fBatchTarget.resetNumberOfDraws();
|
||||
|
||||
|
@ -157,8 +157,8 @@ GrInOrderDrawBuffer::setupPipelineAndShouldDraw(const GrPrimitiveProcessor* prim
|
||||
return NULL;
|
||||
}
|
||||
|
||||
state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker,
|
||||
state->getPipeline()->getInitBatchTracker());
|
||||
state->fPrimitiveProcessor->initBatchTracker(
|
||||
&state->fBatchTracker, state->getPipeline()->infoForPrimitiveProcessor());
|
||||
|
||||
if (fPrevState && fPrevState->fPrimitiveProcessor.get() &&
|
||||
fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker,
|
||||
@ -186,7 +186,7 @@ GrInOrderDrawBuffer::setupPipelineAndShouldDraw(GrBatch* batch,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
batch->initBatchTracker(state->getPipeline()->getInitBatchTracker());
|
||||
batch->initBatchTracker(state->getPipeline()->infoForPrimitiveProcessor());
|
||||
|
||||
if (fPrevState && !fPrevState->fPrimitiveProcessor.get() &&
|
||||
fPrevState->getPipeline()->isEqual(*state->getPipeline())) {
|
||||
|
@ -661,18 +661,17 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fStroke = fGeoData[0].fStroke;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
@ -876,18 +875,17 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsCoverage()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fStroke = fGeoData[0].fStroke;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
@ -1140,18 +1138,17 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fMode = fGeoData[0].fMode;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
@ -1489,18 +1486,17 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fStroke = fGeoData[0].fStroke;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
@ -1662,18 +1658,17 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fStroke = fGeoData[0].fStroke;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
|
@ -32,17 +32,18 @@ void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con
|
||||
|
||||
void GrPathProcessor::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
|
||||
PathBatchTracker* local = bt->cast<PathBatchTracker>();
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
local->fInputColorType = kIgnored_GrGPInput;
|
||||
local->fColor = GrColor_ILLEGAL;
|
||||
} else {
|
||||
local->fInputColorType = kUniform_GrGPInput;
|
||||
local->fColor = GrColor_ILLEGAL == init.fOverrideColor ? this->color() :
|
||||
init.fOverrideColor;
|
||||
if (!init.getOverrideColorIfSet(&local->fColor)) {
|
||||
local->fColor = this->color();
|
||||
}
|
||||
}
|
||||
|
||||
local->fInputCoverageType = init.fCoverageIgnored ? kIgnored_GrGPInput : kAllOnes_GrGPInput;
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
local->fInputCoverageType = init.readsCoverage() ? kAllOnes_GrGPInput : kIgnored_GrGPInput;
|
||||
local->fUsesLocalCoords = init.readsLocalCoords();
|
||||
}
|
||||
|
||||
bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m,
|
||||
|
@ -30,7 +30,7 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
|
||||
overrideColor = colorPOI.inputColorToEffectiveStage();
|
||||
}
|
||||
|
||||
GrXferProcessor::OptFlags optFlags;
|
||||
GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
|
||||
if (xferProcessor) {
|
||||
fXferProcessor.reset(xferProcessor.get());
|
||||
|
||||
@ -41,6 +41,11 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
|
||||
caps);
|
||||
}
|
||||
|
||||
// No need to have an override color if it isn't even going to be used.
|
||||
if (SkToBool(GrXferProcessor::kIgnoreColor_OptFlag & optFlags)) {
|
||||
overrideColor = GrColor_ILLEGAL;
|
||||
}
|
||||
|
||||
// When path rendering the stencil settings are not always set on the GrPipelineBuilder
|
||||
// so we must check the draw type. In cases where we will skip drawing we simply return a
|
||||
// null GrPipeline.
|
||||
@ -98,13 +103,25 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
|
||||
pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords();
|
||||
}
|
||||
|
||||
// let the GP init the batch tracker
|
||||
fInitBT.fColorIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag);
|
||||
fInitBT.fOverrideColor = fInitBT.fColorIgnored ? GrColor_ILLEGAL : overrideColor;
|
||||
fInitBT.fCoverageIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag);
|
||||
fInitBT.fUsesLocalCoords = usesLocalCoords;
|
||||
fInitBT.fCanTweakAlphaForCoverage =
|
||||
SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag);
|
||||
// Setup info we need to pass to GrPrimitiveProcessors that are used with this GrPipeline.
|
||||
fInfoForPrimitiveProcessor.fFlags = 0;
|
||||
if (!SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) {
|
||||
fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsColor_GrPipelineInfoFlag;
|
||||
}
|
||||
if (GrColor_ILLEGAL != overrideColor) {
|
||||
fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kUseOverrideColor_GrPipelineInfoFlag;
|
||||
fInfoForPrimitiveProcessor.fOverrideColor = overrideColor;
|
||||
}
|
||||
if (!SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag)) {
|
||||
fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsCoverage_GrPipelineInfoFlag;
|
||||
}
|
||||
if (usesLocalCoords) {
|
||||
fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsLocalCoords_GrPipelineInfoFlag;
|
||||
}
|
||||
if (SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag)) {
|
||||
fInfoForPrimitiveProcessor.fFlags |=
|
||||
GrPipelineInfo::kCanTweakAlphaForCoverage_GrPipelineInfoFlag;
|
||||
}
|
||||
}
|
||||
|
||||
void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelineBuilder,
|
||||
|
@ -97,7 +97,9 @@ public:
|
||||
|
||||
bool readsFragPosition() const { return fReadsFragPosition; }
|
||||
|
||||
const GrPipelineInfo& getInitBatchTracker() const { return fInitBT; }
|
||||
const GrPipelineInfo& infoForPrimitiveProcessor() const {
|
||||
return fInfoForPrimitiveProcessor;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -135,7 +137,7 @@ private:
|
||||
ProgramXferProcessor fXferProcessor;
|
||||
FragmentStageArray fFragmentStages;
|
||||
bool fReadsFragPosition;
|
||||
GrPipelineInfo fInitBT;
|
||||
GrPipelineInfo fInfoForPrimitiveProcessor;
|
||||
|
||||
// This function is equivalent to the offset into fFragmentStages where coverage stages begin.
|
||||
int fNumColorStages;
|
||||
|
@ -72,16 +72,65 @@ class GrGLPrimitiveProcessor;
|
||||
struct GrInitInvariantOutput;
|
||||
|
||||
/*
|
||||
* This struct allows the GrPipeline to communicate information about the pipeline. Most of this
|
||||
* is overrides, but some of it is general information. Logically it should live in GrPipeline.h,
|
||||
* but this is problematic due to circular dependencies.
|
||||
* This class allows the GrPipeline to communicate information about the pipeline to a
|
||||
* GrPrimitiveProcessor that will be used in conjunction with the GrPipeline.
|
||||
*/
|
||||
struct GrPipelineInfo {
|
||||
bool fColorIgnored;
|
||||
bool fCoverageIgnored;
|
||||
GrColor fOverrideColor;
|
||||
bool fUsesLocalCoords;
|
||||
bool fCanTweakAlphaForCoverage;
|
||||
class GrPipelineInfo {
|
||||
public:
|
||||
/** Does the pipeline require the GrPrimitiveProcessor's color? */
|
||||
bool readsColor() const { return SkToBool(kReadsColor_GrPipelineInfoFlag & fFlags); }
|
||||
|
||||
/** Does the pipeline require the GrPrimitiveProcessor's coverage? */
|
||||
bool readsCoverage() const { return SkToBool(kReadsCoverage_GrPipelineInfoFlag & fFlags); }
|
||||
|
||||
/** Does the pipeline require access to (implicit or explicit) local coordinates? */
|
||||
bool readsLocalCoords() const {
|
||||
return SkToBool(kReadsLocalCoords_GrPipelineInfoFlag & fFlags);
|
||||
}
|
||||
|
||||
/** Does the pipeline allow the GrPrimitiveProcessor to combine color and coverage into one
|
||||
color output ? */
|
||||
bool canTweakAlphaForCoverage() const {
|
||||
return SkToBool(kCanTweakAlphaForCoverage_GrPipelineInfoFlag & fFlags);
|
||||
}
|
||||
|
||||
/** Does the pipeline require the GrPrimitiveProcessor to specify a specific color (and if
|
||||
so get the color)? */
|
||||
bool getOverrideColorIfSet(GrColor* overrideColor) const {
|
||||
if (SkToBool(kUseOverrideColor_GrPipelineInfoFlag & fFlags)) {
|
||||
SkASSERT(SkToBool(kReadsColor_GrPipelineInfoFlag & fFlags));
|
||||
if (overrideColor) {
|
||||
*overrideColor = fOverrideColor;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
enum {
|
||||
// If this is not set the primitive processor need not produce a color output
|
||||
kReadsColor_GrPipelineInfoFlag = 0x1,
|
||||
|
||||
// If this is not set the primitive processor need not produce a coverage output
|
||||
kReadsCoverage_GrPipelineInfoFlag = 0x2,
|
||||
|
||||
// If this is not set the primitive processor need not produce local coordinates
|
||||
kReadsLocalCoords_GrPipelineInfoFlag = 0x4,
|
||||
|
||||
// If this flag is set then the primitive processor may produce color*coverage as
|
||||
// its color output (and not output a separate coverage).
|
||||
kCanTweakAlphaForCoverage_GrPipelineInfoFlag = 0x8,
|
||||
|
||||
// If this flag is set the GrPrimitiveProcessor must produce fOverrideColor as its
|
||||
// output color. If not set fOverrideColor is to be ignored.
|
||||
kUseOverrideColor_GrPipelineInfoFlag = 0x10,
|
||||
};
|
||||
|
||||
uint32_t fFlags;
|
||||
GrColor fOverrideColor;
|
||||
|
||||
friend class GrPipeline; // To initialize this
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -70,17 +70,16 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
|
@ -1375,11 +1375,10 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fColor);
|
||||
fPipelineInfo = init;
|
||||
}
|
||||
|
||||
@ -1412,8 +1411,8 @@ public:
|
||||
LOG("got %d pts, %d contours\n", maxPts, contourCnt);
|
||||
uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType;
|
||||
SkAutoTUnref<const GrGeometryProcessor> gp(
|
||||
GrDefaultGeoProcFactory::Create(flags, fColor, fPipelineInfo.fUsesLocalCoords,
|
||||
fPipelineInfo.fCoverageIgnored, fViewMatrix,
|
||||
GrDefaultGeoProcFactory::Create(flags, fColor, fPipelineInfo.readsLocalCoords(),
|
||||
!fPipelineInfo.readsCoverage(), fViewMatrix,
|
||||
SkMatrix::I()));
|
||||
batchTarget->initDraw(gp, pipeline);
|
||||
|
||||
|
@ -34,17 +34,16 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
this->geoData(0)->fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
this->geoData(0)->fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&this->geoData(0)->fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = this->geoData(0)->fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
|
||||
|
@ -66,7 +66,8 @@ private:
|
||||
|
||||
void GrConstColorProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
|
||||
if (kIgnore_InputMode == fMode) {
|
||||
inout->setToOther(kRGBA_GrColorComponentFlags, fColor, GrInvariantOutput::kWill_ReadInput);
|
||||
inout->setToOther(kRGBA_GrColorComponentFlags, fColor,
|
||||
GrInvariantOutput::kWillNot_ReadInput);
|
||||
} else {
|
||||
GrColor r = GrColorUnpackR(fColor);
|
||||
bool colorIsSingleChannel = r == GrColorUnpackG(fColor) && r == GrColorUnpackB(fColor) &&
|
||||
|
@ -755,7 +755,7 @@ GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrProcOptInfo& colo
|
||||
= blend(f*Sa, Da)
|
||||
*/
|
||||
|
||||
OptFlags flags = kNone_Opt;
|
||||
OptFlags flags = kNone_OptFlags;
|
||||
if (colorPOI.allStagesMultiplyInput()) {
|
||||
flags |= kCanTweakAlphaForCoverage_OptFlag;
|
||||
}
|
||||
|
@ -274,17 +274,16 @@ public:
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
// Handle any color overrides
|
||||
if (init.fColorIgnored) {
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
|
||||
fGeoData[0].fColor = init.fOverrideColor;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = init.fColorIgnored;
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
}
|
||||
|
||||
struct DashDraw {
|
||||
|
@ -428,7 +428,7 @@ PorterDuffXferProcessor::onGetOptimizations(const GrProcOptInfo& colorPOI,
|
||||
bool doesStencilWrite,
|
||||
GrColor* overrideColor,
|
||||
const GrCaps& caps) {
|
||||
GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_Opt;
|
||||
GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
|
||||
if (!fBlendFormula.modifiesDst()) {
|
||||
if (!doesStencilWrite) {
|
||||
optFlags |= GrXferProcessor::kSkipDraw_OptFlag;
|
||||
@ -471,7 +471,7 @@ public:
|
||||
private:
|
||||
GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo&, const GrProcOptInfo&,
|
||||
bool, GrColor*, const GrCaps&) override {
|
||||
return kNone_Opt;
|
||||
return kNone_OptFlags;
|
||||
}
|
||||
|
||||
void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
|
||||
|
@ -62,7 +62,7 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
kNone_Opt = GrXferProcessor::kNone_Opt,
|
||||
kNone_OptFlags = GrXferProcessor::kNone_OptFlags,
|
||||
kSkipDraw_OptFlag = GrXferProcessor::kSkipDraw_OptFlag,
|
||||
kIgnoreColor_OptFlag = GrXferProcessor::kIgnoreColor_OptFlag,
|
||||
kIgnoreCoverage_OptFlag = GrXferProcessor::kIgnoreCoverage_OptFlag,
|
||||
@ -128,7 +128,7 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
|
||||
case SkXfermode::kSrc_Mode:
|
||||
TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
|
||||
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -175,7 +175,7 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
|
||||
case SkXfermode::kSrcIn_Mode:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
|
||||
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -186,7 +186,7 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
|
||||
case SkXfermode::kDstIn_Mode:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
|
||||
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -197,7 +197,7 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
|
||||
case SkXfermode::kSrcOut_Mode:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
|
||||
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -230,7 +230,7 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
|
||||
case SkXfermode::kDstATop_Mode:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
|
||||
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -263,7 +263,7 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
|
||||
case SkXfermode::kModulate_Mode:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
|
||||
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
@ -663,7 +663,7 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
|
||||
case SkXfermode::kModulate_Mode:
|
||||
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
|
||||
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
|
||||
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
|
||||
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
|
||||
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
|
||||
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation);
|
||||
|
Loading…
Reference in New Issue
Block a user