Revert of Rework GrPipelineInfo (patchset #7 id:120001 of https://codereview.chromium.org/1213383005/)

Reason for revert:
breaking stuff!

Original issue's description:
> Makes GrPipelineInfo a class with query functions used by GrBatch subclasses.
>
> Committed: https://skia.googlesource.com/skia/+/f5179a4c490bc787190321bd8ffdb0e6a4efa9ac

TBR=joshualitt@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1213013003
This commit is contained in:
bsalomon 2015-07-08 10:20:21 -07:00 committed by Commit bot
parent 60c0475575
commit d07a2793ba
26 changed files with 189 additions and 238 deletions

View File

@ -103,6 +103,10 @@ public:
* Optimizations for blending / coverage that an OptDrawState should apply to itself. * Optimizations for blending / coverage that an OptDrawState should apply to itself.
*/ */
enum OptFlags { enum OptFlags {
/**
* No optimizations needed
*/
kNone_Opt = 0,
/** /**
* The draw can be skipped completely. * The draw can be skipped completely.
*/ */
@ -125,8 +129,6 @@ public:
kCanTweakAlphaForCoverage_OptFlag = 0x20, kCanTweakAlphaForCoverage_OptFlag = 0x20,
}; };
static const OptFlags kNone_OptFlags = (OptFlags)0;
GR_DECL_BITFIELD_OPS_FRIENDS(OptFlags); GR_DECL_BITFIELD_OPS_FRIENDS(OptFlags);
/** /**

View File

@ -271,7 +271,7 @@ GrXferProcessor::OptFlags ArithmeticXP::onGetOptimizations(const GrProcOptInfo&
bool doesStencilWrite, bool doesStencilWrite,
GrColor* overrideColor, GrColor* overrideColor,
const GrCaps& caps) { const GrCaps& caps) {
return GrXferProcessor::kNone_OptFlags; return GrXferProcessor::kNone_Opt;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -761,18 +761,19 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks(); fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks();
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage;
} }
void generateGeometryLinesOnly(GrBatchTarget* batchTarget, const GrPipeline* pipeline) { void generateGeometryLinesOnly(GrBatchTarget* batchTarget, const GrPipeline* pipeline) {

View File

@ -157,15 +157,16 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fBatch.fColor = GrColor_ILLEGAL; fBatch.fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fBatch.fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fBatch.fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
struct FlushInfo { struct FlushInfo {

View File

@ -700,16 +700,17 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
fBatch.fCoverage = fGeoData[0].fCoverage; fBatch.fCoverage = fGeoData[0].fCoverage;
} }

View File

@ -136,18 +136,19 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks(); fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks();
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage;
} }
void draw(GrBatchTarget* batchTarget, const GrPipeline* pipeline, int vertexCount, void draw(GrBatchTarget* batchTarget, const GrPipeline* pipeline, int vertexCount,

View File

@ -76,16 +76,18 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fBatch.fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fBatch.fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fColor = fGeoData[0].fColor;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
@ -422,18 +424,19 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
fBatch.fMiterStroke = fGeoData[0].fMiterStroke; fBatch.fMiterStroke = fGeoData[0].fMiterStroke;
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {

View File

@ -1498,15 +1498,16 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fBatch.fColor = GrColor_ILLEGAL; fBatch.fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fBatch.fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fBatch.fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
struct FlushInfo { struct FlushInfo {

View File

@ -24,16 +24,16 @@ public:
GrColor color, GrColor color,
const SkMatrix& viewMatrix, const SkMatrix& viewMatrix,
const SkMatrix& localMatrix, const SkMatrix& localMatrix,
bool localCoordsWillBeRead, bool usesLocalCoords,
bool coverageWillBeIgnored, bool coverageIgnored,
uint8_t coverage) { uint8_t coverage) {
return SkNEW_ARGS(DefaultGeoProc, (gpTypeFlags, return SkNEW_ARGS(DefaultGeoProc, (gpTypeFlags,
color, color,
viewMatrix, viewMatrix,
localMatrix, localMatrix,
coverage, coverage,
localCoordsWillBeRead, usesLocalCoords,
coverageWillBeIgnored)); coverageIgnored));
} }
const char* name() const override { return "DefaultGeometryProcessor"; } const char* name() const override { return "DefaultGeometryProcessor"; }
@ -47,9 +47,9 @@ public:
bool hasVertexColor() const { return SkToBool(fInColor); } bool hasVertexColor() const { return SkToBool(fInColor); }
const SkMatrix& viewMatrix() const { return fViewMatrix; } const SkMatrix& viewMatrix() const { return fViewMatrix; }
const SkMatrix& localMatrix() const { return fLocalMatrix; } const SkMatrix& localMatrix() const { return fLocalMatrix; }
bool localCoordsWillBeRead() const { return fLocalCoordsWillBeRead; } bool usesLocalCoords() const { return fUsesLocalCoords; }
uint8_t coverage() const { return fCoverage; } uint8_t coverage() const { return fCoverage; }
bool coverageWillBeIgnored() const { return fCoverageWillBeIgnored; } bool coverageIgnored() const { return fCoverageIgnored; }
bool hasVertexCoverage() const { return SkToBool(fInCoverage); } bool hasVertexCoverage() const { return SkToBool(fInCoverage); }
class GLProcessor : public GrGLGeometryProcessor { class GLProcessor : public GrGLGeometryProcessor {
@ -90,7 +90,7 @@ public:
} }
// Setup coverage as pass through // Setup coverage as pass through
if (!gp.coverageWillBeIgnored()) { if (!gp.coverageIgnored()) {
if (gp.hasVertexCoverage()) { if (gp.hasVertexCoverage()) {
fs->codeAppendf("float alpha = 1.0;"); fs->codeAppendf("float alpha = 1.0;");
args.fPB->addPassThroughAttribute(gp.inCoverage(), "alpha"); args.fPB->addPassThroughAttribute(gp.inCoverage(), "alpha");
@ -116,12 +116,11 @@ public:
const DefaultGeoProc& def = gp.cast<DefaultGeoProc>(); const DefaultGeoProc& def = gp.cast<DefaultGeoProc>();
uint32_t key = def.fFlags; uint32_t key = def.fFlags;
key |= def.colorIgnored() << 8; key |= def.colorIgnored() << 8;
key |= def.coverageWillBeIgnored() << 9; key |= def.coverageIgnored() << 9;
key |= def.hasVertexColor() << 10; key |= def.hasVertexColor() << 10;
key |= def.hasVertexCoverage() << 11; key |= def.hasVertexCoverage() << 11;
key |= def.coverage() == 0xff ? 0x1 << 12 : 0; key |= def.coverage() == 0xff ? 0x1 << 12 : 0;
key |= def.localCoordsWillBeRead() && def.localMatrix().hasPerspective() ? 0x1 << 24 : key |= def.usesLocalCoords() && def.localMatrix().hasPerspective() ? 0x1 << 24 : 0x0;
0x0;
key |= ComputePosKey(def.viewMatrix()) << 25; key |= ComputePosKey(def.viewMatrix()) << 25;
b->add32(key); b->add32(key);
} }
@ -145,8 +144,7 @@ public:
fColor = dgp.color(); fColor = dgp.color();
} }
if (!dgp.coverageWillBeIgnored() && if (!dgp.coverageIgnored() && dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) {
dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) {
pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(dgp.coverage())); pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(dgp.coverage()));
fCoverage = dgp.coverage(); fCoverage = dgp.coverage();
} }
@ -187,8 +185,8 @@ private:
const SkMatrix& viewMatrix, const SkMatrix& viewMatrix,
const SkMatrix& localMatrix, const SkMatrix& localMatrix,
uint8_t coverage, uint8_t coverage,
bool localCoordsWillBeRead, bool usesLocalCoords,
bool coverageWillBeIgnored) bool coverageIgnored)
: fInPosition(NULL) : fInPosition(NULL)
, fInColor(NULL) , fInColor(NULL)
, fInLocalCoords(NULL) , fInLocalCoords(NULL)
@ -198,8 +196,8 @@ private:
, fLocalMatrix(localMatrix) , fLocalMatrix(localMatrix)
, fCoverage(coverage) , fCoverage(coverage)
, fFlags(gpTypeFlags) , fFlags(gpTypeFlags)
, fLocalCoordsWillBeRead(localCoordsWillBeRead) , fUsesLocalCoords(usesLocalCoords)
, fCoverageWillBeIgnored(coverageWillBeIgnored) { , fCoverageIgnored(coverageIgnored) {
this->initClassID<DefaultGeoProc>(); this->initClassID<DefaultGeoProc>();
bool hasColor = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kColor_GPType); bool hasColor = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kColor_GPType);
bool hasLocalCoord = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kLocalCoord_GPType); bool hasLocalCoord = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kLocalCoord_GPType);
@ -216,7 +214,7 @@ private:
} }
if (hasCoverage) { if (hasCoverage) {
fInCoverage = &this->addVertexAttrib(Attribute("inCoverage", fInCoverage = &this->addVertexAttrib(Attribute("inCoverage",
kFloat_GrVertexAttribType)); kFloat_GrVertexAttribType));
} }
} }
@ -229,8 +227,8 @@ private:
SkMatrix fLocalMatrix; SkMatrix fLocalMatrix;
uint8_t fCoverage; uint8_t fCoverage;
uint32_t fFlags; uint32_t fFlags;
bool fLocalCoordsWillBeRead; bool fUsesLocalCoords;
bool fCoverageWillBeIgnored; bool fCoverageIgnored;
GR_DECLARE_GEOMETRY_PROCESSOR_TEST; GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
@ -265,8 +263,8 @@ GrGeometryProcessor* DefaultGeoProc::TestCreate(SkRandom* random,
const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags, const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags,
GrColor color, GrColor color,
bool localCoordsWillBeRead, bool usesLocalCoords,
bool coverageWillBeIgnored, bool coverageIgnored,
const SkMatrix& viewMatrix, const SkMatrix& viewMatrix,
const SkMatrix& localMatrix, const SkMatrix& localMatrix,
uint8_t coverage) { uint8_t coverage) {
@ -274,7 +272,7 @@ const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags,
color, color,
viewMatrix, viewMatrix,
localMatrix, localMatrix,
localCoordsWillBeRead, usesLocalCoords,
coverageWillBeIgnored, coverageIgnored,
coverage); coverage);
} }

View File

@ -74,17 +74,17 @@ public:
}; };
/* /*
* The following functions are used to create default GPs. If you just need to create * 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 * attributes seperately from creating the default GP, use the SetAttribs function followed
* by the Create function. Otherwise use CreateAndSetAttribs to do both at once. * by the Create function. Otherwise use CreateAndSetAttribs to do both at once.
* *
* You must unref the return from Create. * You must unref the return from Create.
*/ */
// TODO clean this up // TODO clean this up
static const GrGeometryProcessor* Create(uint32_t gpTypeFlags, static const GrGeometryProcessor* Create(uint32_t gpTypeFlags,
GrColor, GrColor,
bool localCoordsWillBeRead, bool usesLocalCoords,
bool coverageWillBeIgnored, bool coverageIgnored,
const SkMatrix& viewMatrix = SkMatrix::I(), const SkMatrix& viewMatrix = SkMatrix::I(),
const SkMatrix& localMatrix = SkMatrix::I(), const SkMatrix& localMatrix = SkMatrix::I(),
uint8_t coverage = 0xff); uint8_t coverage = 0xff);

View File

@ -237,16 +237,17 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {

View File

@ -275,16 +275,17 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
@ -613,16 +614,17 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {

View File

@ -33,7 +33,7 @@ void GrImmediateDrawTarget::onDrawBatch(GrBatch* batch,
return; return;
} }
batch->initBatchTracker(pipeline->infoForPrimitiveProcessor()); batch->initBatchTracker(pipeline->getInitBatchTracker());
fBatchTarget.resetNumberOfDraws(); fBatchTarget.resetNumberOfDraws();

View File

@ -157,8 +157,8 @@ GrInOrderDrawBuffer::setupPipelineAndShouldDraw(const GrPrimitiveProcessor* prim
return NULL; return NULL;
} }
state->fPrimitiveProcessor->initBatchTracker( state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker,
&state->fBatchTracker, state->getPipeline()->infoForPrimitiveProcessor()); state->getPipeline()->getInitBatchTracker());
if (fPrevState && fPrevState->fPrimitiveProcessor.get() && if (fPrevState && fPrevState->fPrimitiveProcessor.get() &&
fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker,
@ -186,7 +186,7 @@ GrInOrderDrawBuffer::setupPipelineAndShouldDraw(GrBatch* batch,
return NULL; return NULL;
} }
batch->initBatchTracker(state->getPipeline()->infoForPrimitiveProcessor()); batch->initBatchTracker(state->getPipeline()->getInitBatchTracker());
if (fPrevState && !fPrevState->fPrimitiveProcessor.get() && if (fPrevState && !fPrevState->fPrimitiveProcessor.get() &&
fPrevState->getPipeline()->isEqual(*state->getPipeline())) { fPrevState->getPipeline()->isEqual(*state->getPipeline())) {

View File

@ -661,17 +661,18 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fStroke = fGeoData[0].fStroke; fBatch.fStroke = fGeoData[0].fStroke;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
@ -875,17 +876,18 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsCoverage()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fStroke = fGeoData[0].fStroke; fBatch.fStroke = fGeoData[0].fStroke;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
@ -1138,17 +1140,18 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fMode = fGeoData[0].fMode; fBatch.fMode = fGeoData[0].fMode;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
@ -1486,17 +1489,18 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fStroke = fGeoData[0].fStroke; fBatch.fStroke = fGeoData[0].fStroke;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
@ -1658,17 +1662,18 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fStroke = fGeoData[0].fStroke; fBatch.fStroke = fGeoData[0].fStroke;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {

View File

@ -32,18 +32,17 @@ void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con
void GrPathProcessor::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const { void GrPathProcessor::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
PathBatchTracker* local = bt->cast<PathBatchTracker>(); PathBatchTracker* local = bt->cast<PathBatchTracker>();
if (!init.readsColor()) { if (init.fColorIgnored) {
local->fInputColorType = kIgnored_GrGPInput; local->fInputColorType = kIgnored_GrGPInput;
local->fColor = GrColor_ILLEGAL; local->fColor = GrColor_ILLEGAL;
} else { } else {
local->fInputColorType = kUniform_GrGPInput; local->fInputColorType = kUniform_GrGPInput;
if (!init.getOverrideColorIfSet(&local->fColor)) { local->fColor = GrColor_ILLEGAL == init.fOverrideColor ? this->color() :
local->fColor = this->color(); init.fOverrideColor;
}
} }
local->fInputCoverageType = init.readsCoverage() ? kAllOnes_GrGPInput : kIgnored_GrGPInput; local->fInputCoverageType = init.fCoverageIgnored ? kIgnored_GrGPInput : kAllOnes_GrGPInput;
local->fUsesLocalCoords = init.readsLocalCoords(); local->fUsesLocalCoords = init.fUsesLocalCoords;
} }
bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m, bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m,

View File

@ -30,7 +30,7 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
overrideColor = colorPOI.inputColorToEffectiveStage(); overrideColor = colorPOI.inputColorToEffectiveStage();
} }
GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags; GrXferProcessor::OptFlags optFlags;
if (xferProcessor) { if (xferProcessor) {
fXferProcessor.reset(xferProcessor.get()); fXferProcessor.reset(xferProcessor.get());
@ -41,11 +41,6 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
caps); caps);
} }
// No need to have an override color if it isn't even going to be used.
if (SkToBool(GrXferProcessor::kIgnoreColor_OptFlag)) {
overrideColor = GrColor_ILLEGAL;
}
// When path rendering the stencil settings are not always set on the GrPipelineBuilder // 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 // so we must check the draw type. In cases where we will skip drawing we simply return a
// null GrPipeline. // null GrPipeline.
@ -103,25 +98,13 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords(); pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords();
} }
// Setup info we need to pass to GrPrimitiveProcessors that are used with this GrPipeline. // let the GP init the batch tracker
fInfoForPrimitiveProcessor.fFlags = 0; fInitBT.fColorIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag);
if (!SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) { fInitBT.fOverrideColor = fInitBT.fColorIgnored ? GrColor_ILLEGAL : overrideColor;
fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsColor_GrPipelineInfoFlag; fInitBT.fCoverageIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag);
} fInitBT.fUsesLocalCoords = usesLocalCoords;
if (GrColor_ILLEGAL != overrideColor) { fInitBT.fCanTweakAlphaForCoverage =
fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kUseOverrideColor_GrPipelineInfoFlag; SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag);
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, void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelineBuilder,

View File

@ -97,9 +97,7 @@ public:
bool readsFragPosition() const { return fReadsFragPosition; } bool readsFragPosition() const { return fReadsFragPosition; }
const GrPipelineInfo& infoForPrimitiveProcessor() const { const GrPipelineInfo& getInitBatchTracker() const { return fInitBT; }
return fInfoForPrimitiveProcessor;
}
private: private:
/** /**
@ -137,7 +135,7 @@ private:
ProgramXferProcessor fXferProcessor; ProgramXferProcessor fXferProcessor;
FragmentStageArray fFragmentStages; FragmentStageArray fFragmentStages;
bool fReadsFragPosition; bool fReadsFragPosition;
GrPipelineInfo fInfoForPrimitiveProcessor; GrPipelineInfo fInitBT;
// This function is equivalent to the offset into fFragmentStages where coverage stages begin. // This function is equivalent to the offset into fFragmentStages where coverage stages begin.
int fNumColorStages; int fNumColorStages;

View File

@ -72,65 +72,16 @@ class GrGLPrimitiveProcessor;
struct GrInitInvariantOutput; struct GrInitInvariantOutput;
/* /*
* This class allows the GrPipeline to communicate information about the pipeline to a * This struct allows the GrPipeline to communicate information about the pipeline. Most of this
* GrPrimitiveProcessor that will be used in conjunction with the GrPipeline. * is overrides, but some of it is general information. Logically it should live in GrPipeline.h,
* but this is problematic due to circular dependencies.
*/ */
class GrPipelineInfo { struct GrPipelineInfo {
public: bool fColorIgnored;
/** Does the pipeline require the GrPrimitiveProcessor's color? */ bool fCoverageIgnored;
bool readsColor() const { return SkToBool(kReadsColor_GrPipelineInfoFlag & fFlags); } GrColor fOverrideColor;
bool fUsesLocalCoords;
/** Does the pipeline require the GrPrimitiveProcessor's coverage? */ bool fCanTweakAlphaForCoverage;
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
}; };
/* /*

View File

@ -70,16 +70,17 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {

View File

@ -1375,10 +1375,11 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fColor = GrColor_ILLEGAL; fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fColor);
fPipelineInfo = init; fPipelineInfo = init;
} }
@ -1411,8 +1412,8 @@ public:
LOG("got %d pts, %d contours\n", maxPts, contourCnt); LOG("got %d pts, %d contours\n", maxPts, contourCnt);
uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType; uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType;
SkAutoTUnref<const GrGeometryProcessor> gp( SkAutoTUnref<const GrGeometryProcessor> gp(
GrDefaultGeoProcFactory::Create(flags, fColor, fPipelineInfo.readsLocalCoords(), GrDefaultGeoProcFactory::Create(flags, fColor, fPipelineInfo.fUsesLocalCoords,
!fPipelineInfo.readsCoverage(), fViewMatrix, fPipelineInfo.fCoverageIgnored, fViewMatrix,
SkMatrix::I())); SkMatrix::I()));
batchTarget->initDraw(gp, pipeline); batchTarget->initDraw(gp, pipeline);

View File

@ -34,16 +34,17 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
this->geoData(0)->fColor = GrColor_ILLEGAL; 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 // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = this->geoData(0)->fColor; fBatch.fColor = this->geoData(0)->fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {

View File

@ -755,7 +755,7 @@ GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrProcOptInfo& colo
= blend(f*Sa, Da) = blend(f*Sa, Da)
*/ */
OptFlags flags = kNone_OptFlags; OptFlags flags = kNone_Opt;
if (colorPOI.allStagesMultiplyInput()) { if (colorPOI.allStagesMultiplyInput()) {
flags |= kCanTweakAlphaForCoverage_OptFlag; flags |= kCanTweakAlphaForCoverage_OptFlag;
} }

View File

@ -274,16 +274,17 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override { void initBatchTracker(const GrPipelineInfo& init) override {
// Handle any color overrides // Handle any color overrides
if (!init.readsColor()) { if (init.fColorIgnored) {
fGeoData[0].fColor = GrColor_ILLEGAL; fGeoData[0].fColor = GrColor_ILLEGAL;
} else if (GrColor_ILLEGAL != init.fOverrideColor) {
fGeoData[0].fColor = init.fOverrideColor;
} }
init.getOverrideColorIfSet(&fGeoData[0].fColor);
// setup batch properties // setup batch properties
fBatch.fColorIgnored = !init.readsColor(); fBatch.fColorIgnored = init.fColorIgnored;
fBatch.fColor = fGeoData[0].fColor; fBatch.fColor = fGeoData[0].fColor;
fBatch.fUsesLocalCoords = init.readsLocalCoords(); fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
fBatch.fCoverageIgnored = !init.readsCoverage(); fBatch.fCoverageIgnored = init.fCoverageIgnored;
} }
struct DashDraw { struct DashDraw {

View File

@ -428,7 +428,7 @@ PorterDuffXferProcessor::onGetOptimizations(const GrProcOptInfo& colorPOI,
bool doesStencilWrite, bool doesStencilWrite,
GrColor* overrideColor, GrColor* overrideColor,
const GrCaps& caps) { const GrCaps& caps) {
GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags; GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_Opt;
if (!fBlendFormula.modifiesDst()) { if (!fBlendFormula.modifiesDst()) {
if (!doesStencilWrite) { if (!doesStencilWrite) {
optFlags |= GrXferProcessor::kSkipDraw_OptFlag; optFlags |= GrXferProcessor::kSkipDraw_OptFlag;
@ -471,7 +471,7 @@ public:
private: private:
GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo&, const GrProcOptInfo&, GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo&, const GrProcOptInfo&,
bool, GrColor*, const GrCaps&) override { bool, GrColor*, const GrCaps&) override {
return kNone_OptFlags; return kNone_Opt;
} }
void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;

View File

@ -62,7 +62,7 @@ enum {
}; };
enum { enum {
kNone_OptFlags = GrXferProcessor::kNone_OptFlags, kNone_Opt = GrXferProcessor::kNone_Opt,
kSkipDraw_OptFlag = GrXferProcessor::kSkipDraw_OptFlag, kSkipDraw_OptFlag = GrXferProcessor::kSkipDraw_OptFlag,
kIgnoreColor_OptFlag = GrXferProcessor::kIgnoreColor_OptFlag, kIgnoreColor_OptFlag = GrXferProcessor::kIgnoreColor_OptFlag,
kIgnoreCoverage_OptFlag = GrXferProcessor::kIgnoreCoverage_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: case SkXfermode::kSrc_Mode:
TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 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: case SkXfermode::kSrcIn_Mode:
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 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: case SkXfermode::kDstIn_Mode:
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 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: case SkXfermode::kSrcOut_Mode:
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 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: case SkXfermode::kDstATop_Mode:
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 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: case SkXfermode::kModulate_Mode:
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 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: case SkXfermode::kModulate_Mode:
TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation);