Stop lieing about GrBatch color for Rects
BUG=skia: Review URL: https://codereview.chromium.org/920423003
This commit is contained in:
parent
efe513b6fe
commit
db0f9516ae
@ -711,10 +711,6 @@ public:
|
|||||||
out->setUnknownSingleComponent();
|
out->setUnknownSingleComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBatchOpt(const GrBatchOpt& batchOpt) {
|
|
||||||
fBatchOpt = batchOpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
||||||
// Handle any color overrides
|
// Handle any color overrides
|
||||||
if (init.fColorIgnored) {
|
if (init.fColorIgnored) {
|
||||||
@ -865,7 +861,6 @@ private:
|
|||||||
bool fCoverageIgnored;
|
bool fCoverageIgnored;
|
||||||
};
|
};
|
||||||
|
|
||||||
GrBatchOpt fBatchOpt;
|
|
||||||
BatchTracker fBatch;
|
BatchTracker fBatch;
|
||||||
SkSTArray<1, Geometry, true> fGeoData;
|
SkSTArray<1, Geometry, true> fGeoData;
|
||||||
};
|
};
|
||||||
|
@ -727,10 +727,6 @@ public:
|
|||||||
out->setUnknownSingleComponent();
|
out->setUnknownSingleComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBatchOpt(const GrBatchOpt& batchOpt) {
|
|
||||||
fBatchOpt = batchOpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
||||||
// Handle any color overrides
|
// Handle any color overrides
|
||||||
if (init.fColorIgnored) {
|
if (init.fColorIgnored) {
|
||||||
@ -813,7 +809,6 @@ private:
|
|||||||
bool fCoverageIgnored;
|
bool fCoverageIgnored;
|
||||||
};
|
};
|
||||||
|
|
||||||
GrBatchOpt fBatchOpt;
|
|
||||||
BatchTracker fBatch;
|
BatchTracker fBatch;
|
||||||
SkSTArray<1, Geometry, true> fGeoData;
|
SkSTArray<1, Geometry, true> fGeoData;
|
||||||
const GrIndexBuffer* fLinesIndexBuffer;
|
const GrIndexBuffer* fLinesIndexBuffer;
|
||||||
|
@ -70,25 +70,12 @@ public:
|
|||||||
|
|
||||||
void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE {
|
void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE {
|
||||||
// When this is called on a batch, there is only one geometry bundle
|
// When this is called on a batch, there is only one geometry bundle
|
||||||
if (!this->canTweakAlphaForCoverage() && GrColorIsOpaque(fGeoData[0].fColor)) {
|
out->setKnownFourComponents(fGeoData[0].fColor);
|
||||||
out->setUnknownOpaqueFourComponents();
|
|
||||||
} else {
|
|
||||||
out->setUnknownFourComponents();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE {
|
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE {
|
||||||
if (this->canTweakAlphaForCoverage()) {
|
|
||||||
// uniform coverage
|
|
||||||
out->setKnownSingleComponent(0xff);
|
|
||||||
} else {
|
|
||||||
out->setUnknownSingleComponent();
|
out->setUnknownSingleComponent();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void initBatchOpt(const GrBatchOpt& batchOpt) {
|
|
||||||
fBatchOpt = batchOpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
||||||
// Handle any color overrides
|
// Handle any color overrides
|
||||||
@ -103,6 +90,7 @@ public:
|
|||||||
fBatch.fColor = fGeoData[0].fColor;
|
fBatch.fColor = fGeoData[0].fColor;
|
||||||
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
|
||||||
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
fBatch.fCoverageIgnored = init.fCoverageIgnored;
|
||||||
|
fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) SK_OVERRIDE {
|
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) SK_OVERRIDE {
|
||||||
@ -194,19 +182,12 @@ private:
|
|||||||
|
|
||||||
GrColor color() const { return fBatch.fColor; }
|
GrColor color() const { return fBatch.fColor; }
|
||||||
bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
|
bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
|
||||||
bool canTweakAlphaForCoverage() const { return fBatchOpt.fCanTweakAlphaForCoverage; }
|
bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCoverage; }
|
||||||
bool colorIgnored() const { return fBatch.fColorIgnored; }
|
bool colorIgnored() const { return fBatch.fColorIgnored; }
|
||||||
const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
|
const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
|
||||||
|
|
||||||
bool onCombineIfPossible(GrBatch* t) SK_OVERRIDE {
|
bool onCombineIfPossible(GrBatch* t) SK_OVERRIDE {
|
||||||
AAFillRectBatch* that = t->cast<AAFillRectBatch>();
|
AAFillRectBatch* that = t->cast<AAFillRectBatch>();
|
||||||
if (this->canTweakAlphaForCoverage() != that->canTweakAlphaForCoverage()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->colorIgnored() != that->colorIgnored()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
|
SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
|
||||||
// We apply the viewmatrix to the rect points on the cpu. However, if the pipeline uses
|
// We apply the viewmatrix to the rect points on the cpu. However, if the pipeline uses
|
||||||
@ -219,6 +200,13 @@ private:
|
|||||||
if (this->color() != that->color()) {
|
if (this->color() != that->color()) {
|
||||||
fBatch.fColor = GrColor_ILLEGAL;
|
fBatch.fColor = GrColor_ILLEGAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In the event of two batches, one who can tweak, one who cannot, we just fall back to
|
||||||
|
// not tweaking
|
||||||
|
if (this->canTweakAlphaForCoverage() != that->canTweakAlphaForCoverage()) {
|
||||||
|
fBatch.fCanTweakAlphaForCoverage = false;
|
||||||
|
}
|
||||||
|
|
||||||
fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin());
|
fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -321,9 +309,9 @@ private:
|
|||||||
bool fUsesLocalCoords;
|
bool fUsesLocalCoords;
|
||||||
bool fColorIgnored;
|
bool fColorIgnored;
|
||||||
bool fCoverageIgnored;
|
bool fCoverageIgnored;
|
||||||
|
bool fCanTweakAlphaForCoverage;
|
||||||
};
|
};
|
||||||
|
|
||||||
GrBatchOpt fBatchOpt;
|
|
||||||
BatchTracker fBatch;
|
BatchTracker fBatch;
|
||||||
const GrIndexBuffer* fIndexBuffer;
|
const GrIndexBuffer* fIndexBuffer;
|
||||||
SkSTArray<1, Geometry, true> fGeoData;
|
SkSTArray<1, Geometry, true> fGeoData;
|
||||||
|
@ -39,10 +39,6 @@ struct GrInitInvariantOutput;
|
|||||||
* information will be communicated to the GrBatch prior to geometry generation.
|
* information will be communicated to the GrBatch prior to geometry generation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct GrBatchOpt {
|
|
||||||
bool fCanTweakAlphaForCoverage;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GrBatch : public SkRefCnt {
|
class GrBatch : public SkRefCnt {
|
||||||
public:
|
public:
|
||||||
SK_DECLARE_INST_COUNT(GrBatch)
|
SK_DECLARE_INST_COUNT(GrBatch)
|
||||||
@ -54,13 +50,9 @@ public:
|
|||||||
virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const = 0;
|
virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initBatchOpt is used to communicate possible optimizations to the GrBatch. initBatchTracker
|
* initBatchTracker is a hook for the some additional overrides / optimization possibilities
|
||||||
* is a hook for the some additional overrides from the GrXferProcessor. This is a bit
|
* from the GrXferProcessor.
|
||||||
* confusing but has to be like this until GrBatch is everywhere.
|
|
||||||
*
|
|
||||||
* TODO combine to a single init call when GrBatch is everywhere.
|
|
||||||
*/
|
*/
|
||||||
virtual void initBatchOpt(const GrBatchOpt&) = 0;
|
|
||||||
virtual void initBatchTracker(const GrPipelineInfo& init) = 0;
|
virtual void initBatchTracker(const GrPipelineInfo& init) = 0;
|
||||||
|
|
||||||
bool combineIfPossible(GrBatch* that) {
|
bool combineIfPossible(GrBatch* that) {
|
||||||
|
@ -545,11 +545,6 @@ void GrDrawTarget::drawBatch(GrPipelineBuilder* pipelineBuilder,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// init batch and my other crap
|
|
||||||
GrBatchOpt batchOpt;
|
|
||||||
batchOpt.fCanTweakAlphaForCoverage = pipelineBuilder->canTweakAlphaForCoverage();
|
|
||||||
batch->initBatchOpt(batchOpt);
|
|
||||||
|
|
||||||
GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, batch, devBounds, this);
|
GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, batch, devBounds, this);
|
||||||
if (pipelineInfo.mustSkipDraw()) {
|
if (pipelineInfo.mustSkipDraw()) {
|
||||||
return;
|
return;
|
||||||
|
@ -711,10 +711,6 @@ public:
|
|||||||
out->setUnknownSingleComponent();
|
out->setUnknownSingleComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBatchOpt(const GrBatchOpt& batchOpt) {
|
|
||||||
fBatchOpt = batchOpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
||||||
// Handle any color overrides
|
// Handle any color overrides
|
||||||
if (init.fColorIgnored) {
|
if (init.fColorIgnored) {
|
||||||
@ -873,7 +869,6 @@ private:
|
|||||||
static const int kVertsPerCircle = 4;
|
static const int kVertsPerCircle = 4;
|
||||||
static const int kIndicesPerCircle = 6;
|
static const int kIndicesPerCircle = 6;
|
||||||
|
|
||||||
GrBatchOpt fBatchOpt;
|
|
||||||
BatchTracker fBatch;
|
BatchTracker fBatch;
|
||||||
SkSTArray<1, Geometry, true> fGeoData;
|
SkSTArray<1, Geometry, true> fGeoData;
|
||||||
};
|
};
|
||||||
@ -966,10 +961,6 @@ public:
|
|||||||
out->setUnknownSingleComponent();
|
out->setUnknownSingleComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBatchOpt(const GrBatchOpt& batchOpt) {
|
|
||||||
fBatchOpt = batchOpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
||||||
// Handle any color overrides
|
// Handle any color overrides
|
||||||
if (init.fColorIgnored) {
|
if (init.fColorIgnored) {
|
||||||
@ -1133,7 +1124,6 @@ private:
|
|||||||
static const int kVertsPerEllipse = 4;
|
static const int kVertsPerEllipse = 4;
|
||||||
static const int kIndicesPerEllipse = 6;
|
static const int kIndicesPerEllipse = 6;
|
||||||
|
|
||||||
GrBatchOpt fBatchOpt;
|
|
||||||
BatchTracker fBatch;
|
BatchTracker fBatch;
|
||||||
SkSTArray<1, Geometry, true> fGeoData;
|
SkSTArray<1, Geometry, true> fGeoData;
|
||||||
};
|
};
|
||||||
@ -1267,10 +1257,6 @@ public:
|
|||||||
out->setUnknownSingleComponent();
|
out->setUnknownSingleComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBatchOpt(const GrBatchOpt& batchOpt) {
|
|
||||||
fBatchOpt = batchOpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
||||||
// Handle any color overrides
|
// Handle any color overrides
|
||||||
if (init.fColorIgnored) {
|
if (init.fColorIgnored) {
|
||||||
@ -1425,7 +1411,6 @@ private:
|
|||||||
static const int kVertsPerEllipse = 4;
|
static const int kVertsPerEllipse = 4;
|
||||||
static const int kIndicesPerEllipse = 6;
|
static const int kIndicesPerEllipse = 6;
|
||||||
|
|
||||||
GrBatchOpt fBatchOpt;
|
|
||||||
BatchTracker fBatch;
|
BatchTracker fBatch;
|
||||||
SkSTArray<1, Geometry, true> fGeoData;
|
SkSTArray<1, Geometry, true> fGeoData;
|
||||||
};
|
};
|
||||||
@ -1655,10 +1640,6 @@ public:
|
|||||||
out->setUnknownSingleComponent();
|
out->setUnknownSingleComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBatchOpt(const GrBatchOpt& batchOpt) {
|
|
||||||
fBatchOpt = batchOpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
||||||
// Handle any color overrides
|
// Handle any color overrides
|
||||||
if (init.fColorIgnored) {
|
if (init.fColorIgnored) {
|
||||||
@ -1831,7 +1812,6 @@ private:
|
|||||||
bool fCoverageIgnored;
|
bool fCoverageIgnored;
|
||||||
};
|
};
|
||||||
|
|
||||||
GrBatchOpt fBatchOpt;
|
|
||||||
BatchTracker fBatch;
|
BatchTracker fBatch;
|
||||||
SkSTArray<1, Geometry, true> fGeoData;
|
SkSTArray<1, Geometry, true> fGeoData;
|
||||||
const GrIndexBuffer* fIndexBuffer;
|
const GrIndexBuffer* fIndexBuffer;
|
||||||
@ -1864,10 +1844,6 @@ public:
|
|||||||
out->setUnknownSingleComponent();
|
out->setUnknownSingleComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBatchOpt(const GrBatchOpt& batchOpt) {
|
|
||||||
fBatchOpt = batchOpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
||||||
// Handle any color overrides
|
// Handle any color overrides
|
||||||
if (init.fColorIgnored) {
|
if (init.fColorIgnored) {
|
||||||
@ -2050,7 +2026,6 @@ private:
|
|||||||
bool fCoverageIgnored;
|
bool fCoverageIgnored;
|
||||||
};
|
};
|
||||||
|
|
||||||
GrBatchOpt fBatchOpt;
|
|
||||||
BatchTracker fBatch;
|
BatchTracker fBatch;
|
||||||
SkSTArray<1, Geometry, true> fGeoData;
|
SkSTArray<1, Geometry, true> fGeoData;
|
||||||
const GrIndexBuffer* fIndexBuffer;
|
const GrIndexBuffer* fIndexBuffer;
|
||||||
|
@ -35,8 +35,6 @@ public:
|
|||||||
out->setUnknownSingleComponent();
|
out->setUnknownSingleComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBatchOpt(const GrBatchOpt& batchOpt) {}
|
|
||||||
|
|
||||||
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE {
|
||||||
// Handle any color overrides
|
// Handle any color overrides
|
||||||
if (init.fColorIgnored) {
|
if (init.fColorIgnored) {
|
||||||
|
Loading…
Reference in New Issue
Block a user