Rename GrPipelineInfo to GrPipelineOptimizations
TBR=joshualitt@google.com Review URL: https://codereview.chromium.org/1274513005
This commit is contained in:
parent
7fc2a2610e
commit
91d844de47
@ -761,20 +761,20 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks();
|
||||
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
|
||||
fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
void generateGeometryLinesOnly(GrBatchTarget* batchTarget) {
|
||||
|
@ -147,17 +147,17 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fBatch.fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fBatch.fColor);
|
||||
opt.getOverrideColorIfSet(&fBatch.fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
struct FlushInfo {
|
||||
|
@ -694,18 +694,18 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
fBatch.fCoverage = fGeoData[0].fCoverage;
|
||||
}
|
||||
|
||||
|
@ -139,20 +139,20 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks();
|
||||
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
|
||||
fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
void draw(GrBatchTarget* batchTarget, const GrPipeline* pipeline, int vertexCount,
|
||||
|
@ -1515,18 +1515,18 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
struct FlushInfo {
|
||||
|
@ -236,18 +236,18 @@ public:
|
||||
out->setKnownSingleComponent(this->coverage());
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override {
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
bool willUseGeoShader() const override { return fWillUseGeoShader; }
|
||||
|
||||
// TODO delete when paths are in batch
|
||||
void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override {}
|
||||
void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const override {}
|
||||
|
||||
// TODO delete this when paths are in batch
|
||||
bool canMakeEqual(const GrBatchTracker& mine,
|
||||
|
@ -649,19 +649,19 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fStroke = fGeoData[0].fStroke;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override {
|
||||
@ -867,19 +867,19 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsCoverage()) {
|
||||
if (!opt.readsCoverage()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fStroke = fGeoData[0].fStroke;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override {
|
||||
@ -1134,19 +1134,19 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fMode = fGeoData[0].fMode;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override {
|
||||
@ -1485,19 +1485,19 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fStroke = fGeoData[0].fStroke;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override {
|
||||
@ -1661,19 +1661,19 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fStroke = fGeoData[0].fStroke;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override {
|
||||
|
@ -30,20 +30,20 @@ void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con
|
||||
out->setKnownSingleComponent(0xff);
|
||||
}
|
||||
|
||||
void GrPathProcessor::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
|
||||
void GrPathProcessor::initBatchTracker(GrBatchTracker* bt, const GrPipelineOptimizations& opt) const {
|
||||
PathBatchTracker* local = bt->cast<PathBatchTracker>();
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
local->fInputColorType = kIgnored_GrGPInput;
|
||||
local->fColor = GrColor_ILLEGAL;
|
||||
} else {
|
||||
local->fInputColorType = kUniform_GrGPInput;
|
||||
if (!init.getOverrideColorIfSet(&local->fColor)) {
|
||||
if (!opt.getOverrideColorIfSet(&local->fColor)) {
|
||||
local->fColor = this->color();
|
||||
}
|
||||
}
|
||||
|
||||
local->fInputCoverageType = init.readsCoverage() ? kAllOnes_GrGPInput : kIgnored_GrGPInput;
|
||||
local->fUsesLocalCoords = init.readsLocalCoords();
|
||||
local->fInputCoverageType = opt.readsCoverage() ? kAllOnes_GrGPInput : kIgnored_GrGPInput;
|
||||
local->fUsesLocalCoords = opt.readsLocalCoords();
|
||||
}
|
||||
|
||||
bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m,
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
return SkNEW_ARGS(GrPathProcessor, (color, viewMatrix, localMatrix));
|
||||
}
|
||||
|
||||
void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override;
|
||||
void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const override;
|
||||
|
||||
bool canMakeEqual(const GrBatchTracker& mine,
|
||||
const GrPrimitiveProcessor& that,
|
||||
|
@ -107,21 +107,25 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
|
||||
// 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;
|
||||
fInfoForPrimitiveProcessor.fFlags |=
|
||||
GrPipelineOptimizations::kReadsColor_GrPipelineOptimizationsFlag;
|
||||
}
|
||||
if (GrColor_ILLEGAL != overrideColor) {
|
||||
fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kUseOverrideColor_GrPipelineInfoFlag;
|
||||
fInfoForPrimitiveProcessor.fFlags |=
|
||||
GrPipelineOptimizations::kUseOverrideColor_GrPipelineOptimizationsFlag;
|
||||
fInfoForPrimitiveProcessor.fOverrideColor = overrideColor;
|
||||
}
|
||||
if (!SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag)) {
|
||||
fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsCoverage_GrPipelineInfoFlag;
|
||||
fInfoForPrimitiveProcessor.fFlags |=
|
||||
GrPipelineOptimizations::kReadsCoverage_GrPipelineOptimizationsFlag;
|
||||
}
|
||||
if (usesLocalCoords) {
|
||||
fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsLocalCoords_GrPipelineInfoFlag;
|
||||
fInfoForPrimitiveProcessor.fFlags |=
|
||||
GrPipelineOptimizations::kReadsLocalCoords_GrPipelineOptimizationsFlag;
|
||||
}
|
||||
if (SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag)) {
|
||||
fInfoForPrimitiveProcessor.fFlags |=
|
||||
GrPipelineInfo::kCanTweakAlphaForCoverage_GrPipelineInfoFlag;
|
||||
GrPipelineOptimizations::kCanTweakAlphaForCoverage_GrPipelineOptimizationsFlag;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
|
||||
bool readsFragPosition() const { return fReadsFragPosition; }
|
||||
|
||||
const GrPipelineInfo& infoForPrimitiveProcessor() const {
|
||||
const GrPipelineOptimizations& infoForPrimitiveProcessor() const {
|
||||
return fInfoForPrimitiveProcessor;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ private:
|
||||
ProgramXferProcessor fXferProcessor;
|
||||
FragmentStageArray fFragmentStages;
|
||||
bool fReadsFragPosition;
|
||||
GrPipelineInfo fInfoForPrimitiveProcessor;
|
||||
GrPipelineOptimizations fInfoForPrimitiveProcessor;
|
||||
|
||||
// This function is equivalent to the offset into fFragmentStages where coverage stages begin.
|
||||
int fNumColorStages;
|
||||
|
@ -73,32 +73,38 @@ struct GrInitInvariantOutput;
|
||||
|
||||
/*
|
||||
* This class allows the GrPipeline to communicate information about the pipeline to a
|
||||
* GrPrimitiveProcessor that will be used in conjunction with the GrPipeline.
|
||||
* GrBatch which should be forwarded to the GrPrimitiveProcessor(s) created by the batch.
|
||||
* These are not properly part of the pipeline because they assume the specific inputs
|
||||
* that the batch provided when it created the pipeline. Identical pipelines may be
|
||||
* created by different batches with different input assumptions and therefore different
|
||||
* computed optimizations. It is the batch-specific optimizations that allow the pipelines
|
||||
* to be equal.
|
||||
*/
|
||||
class GrPipelineInfo {
|
||||
class GrPipelineOptimizations {
|
||||
public:
|
||||
/** Does the pipeline require the GrPrimitiveProcessor's color? */
|
||||
bool readsColor() const { return SkToBool(kReadsColor_GrPipelineInfoFlag & fFlags); }
|
||||
bool readsColor() const { return SkToBool(kReadsColor_GrPipelineOptimizationsFlag & fFlags); }
|
||||
|
||||
/** Does the pipeline require the GrPrimitiveProcessor's coverage? */
|
||||
bool readsCoverage() const { return SkToBool(kReadsCoverage_GrPipelineInfoFlag & fFlags); }
|
||||
bool readsCoverage() const { return
|
||||
SkToBool(kReadsCoverage_GrPipelineOptimizationsFlag & fFlags); }
|
||||
|
||||
/** Does the pipeline require access to (implicit or explicit) local coordinates? */
|
||||
bool readsLocalCoords() const {
|
||||
return SkToBool(kReadsLocalCoords_GrPipelineInfoFlag & fFlags);
|
||||
return SkToBool(kReadsLocalCoords_GrPipelineOptimizationsFlag & fFlags);
|
||||
}
|
||||
|
||||
/** Does the pipeline allow the GrPrimitiveProcessor to combine color and coverage into one
|
||||
color output ? */
|
||||
bool canTweakAlphaForCoverage() const {
|
||||
return SkToBool(kCanTweakAlphaForCoverage_GrPipelineInfoFlag & fFlags);
|
||||
return SkToBool(kCanTweakAlphaForCoverage_GrPipelineOptimizationsFlag & 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 (SkToBool(kUseOverrideColor_GrPipelineOptimizationsFlag & fFlags)) {
|
||||
SkASSERT(SkToBool(kReadsColor_GrPipelineOptimizationsFlag & fFlags));
|
||||
if (overrideColor) {
|
||||
*overrideColor = fOverrideColor;
|
||||
}
|
||||
@ -110,21 +116,21 @@ public:
|
||||
private:
|
||||
enum {
|
||||
// If this is not set the primitive processor need not produce a color output
|
||||
kReadsColor_GrPipelineInfoFlag = 0x1,
|
||||
kReadsColor_GrPipelineOptimizationsFlag = 0x1,
|
||||
|
||||
// If this is not set the primitive processor need not produce a coverage output
|
||||
kReadsCoverage_GrPipelineInfoFlag = 0x2,
|
||||
kReadsCoverage_GrPipelineOptimizationsFlag = 0x2,
|
||||
|
||||
// If this is not set the primitive processor need not produce local coordinates
|
||||
kReadsLocalCoords_GrPipelineInfoFlag = 0x4,
|
||||
kReadsLocalCoords_GrPipelineOptimizationsFlag = 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,
|
||||
kCanTweakAlphaForCoverage_GrPipelineOptimizationsFlag = 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,
|
||||
kUseOverrideColor_GrPipelineOptimizationsFlag = 0x10,
|
||||
};
|
||||
|
||||
uint32_t fFlags;
|
||||
@ -151,7 +157,7 @@ enum GrGPInput {
|
||||
*/
|
||||
class GrPrimitiveProcessor : public GrProcessor {
|
||||
public:
|
||||
virtual void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const = 0;
|
||||
virtual void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const = 0;
|
||||
|
||||
virtual bool canMakeEqual(const GrBatchTracker& mine,
|
||||
const GrPrimitiveProcessor& that,
|
||||
|
@ -1413,13 +1413,13 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fColor);
|
||||
fPipelineInfo = init;
|
||||
opt.getOverrideColorIfSet(&fColor);
|
||||
fPipelineInfo = opt;
|
||||
}
|
||||
|
||||
int tessellate(GrUniqueKey* key,
|
||||
@ -1607,12 +1607,12 @@ private:
|
||||
viewMatrix.mapRect(&fBounds);
|
||||
}
|
||||
|
||||
GrColor fColor;
|
||||
SkPath fPath;
|
||||
GrStrokeInfo fStroke;
|
||||
SkMatrix fViewMatrix;
|
||||
SkRect fClipBounds; // in source space
|
||||
GrPipelineInfo fPipelineInfo;
|
||||
GrColor fColor;
|
||||
SkPath fPath;
|
||||
GrStrokeInfo fStroke;
|
||||
SkMatrix fViewMatrix;
|
||||
SkRect fClipBounds; // in source space
|
||||
GrPipelineOptimizations fPipelineInfo;
|
||||
};
|
||||
|
||||
bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
|
@ -41,19 +41,19 @@ static const GrGeometryProcessor* create_fill_rect_gp(bool tweakAlphaForCoverage
|
||||
return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
|
||||
}
|
||||
|
||||
void GrAAFillRectBatch::initBatchTracker(const GrPipelineInfo& init) {
|
||||
void GrAAFillRectBatch::initBatchTracker(const GrPipelineOptimizations& opt) {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
void GrAAFillRectBatch::generateGeometry(GrBatchTarget* batchTarget) {
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override;
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override;
|
||||
|
||||
|
@ -43,20 +43,20 @@ static const GrGeometryProcessor* create_stroke_rect_gp(bool tweakAlphaForCovera
|
||||
}
|
||||
|
||||
|
||||
void GrAAStrokeRectBatch::initBatchTracker(const GrPipelineInfo& init) {
|
||||
void GrAAStrokeRectBatch::initBatchTracker(const GrPipelineOptimizations& opt) {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
fBatch.fMiterStroke = fGeoData[0].fMiterStroke;
|
||||
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
|
||||
fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
void GrAAStrokeRectBatch::generateGeometry(GrBatchTarget* batchTarget) {
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override;
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override;
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
* initBatchTracker is a hook for the some additional overrides / optimization possibilities
|
||||
* from the GrXferProcessor.
|
||||
*/
|
||||
virtual void initBatchTracker(const GrPipelineInfo& init) = 0;
|
||||
virtual void initBatchTracker(const GrPipelineOptimizations&) = 0;
|
||||
|
||||
bool combineIfPossible(GrBatch* that) {
|
||||
if (this->classID() != that->classID()) {
|
||||
|
@ -9,19 +9,19 @@
|
||||
#include "GrBatchTest.h"
|
||||
#include "SkRandom.h"
|
||||
|
||||
void GrDrawAtlasBatch::initBatchTracker(const GrPipelineInfo& init) {
|
||||
void GrDrawAtlasBatch::initBatchTracker(const GrPipelineOptimizations& opt) {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fColorIgnored = !init.readsColor();
|
||||
fColorIgnored = !opt.readsColor();
|
||||
fColor = fGeoData[0].fColor;
|
||||
// We'd like to assert this, but we can't because of GLPrograms test
|
||||
//SkASSERT(init.readsLocalCoords());
|
||||
fCoverageIgnored = !init.readsCoverage();
|
||||
fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
static const GrGeometryProcessor* set_vertex_attributes(bool hasLocalCoords,
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
out->setKnownSingleComponent(0xff);
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override;
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override;
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
@ -93,18 +93,18 @@ void GrDrawVerticesBatch::getInvariantOutputCoverage(GrInitInvariantOutput* out)
|
||||
out->setKnownSingleComponent(0xff);
|
||||
}
|
||||
|
||||
void GrDrawVerticesBatch::initBatchTracker(const GrPipelineInfo& init) {
|
||||
void GrDrawVerticesBatch::initBatchTracker(const GrPipelineOptimizations& opt) {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
void GrDrawVerticesBatch::generateGeometry(GrBatchTarget* batchTarget) {
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override;
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override;
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "GrDefaultGeoProcFactory.h"
|
||||
#include "GrPrimitiveProcessor.h"
|
||||
|
||||
void GrRectBatch::initBatchTracker(const GrPipelineInfo& init) {
|
||||
void GrRectBatch::initBatchTracker(const GrPipelineOptimizations& init) {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
out->setKnownSingleComponent(0xff);
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override;
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override;
|
||||
|
||||
|
@ -28,18 +28,18 @@ GrStrokeRectBatch::GrStrokeRectBatch(const Geometry& geometry, bool snapToPixelC
|
||||
}
|
||||
}
|
||||
|
||||
void GrStrokeRectBatch::initBatchTracker(const GrPipelineInfo& init) {
|
||||
void GrStrokeRectBatch::initBatchTracker(const GrPipelineOptimizations& opt) {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
/* create a triangle strip that strokes the specified rect. There are 8
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
out->setKnownSingleComponent(0xff);
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override;
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override;
|
||||
|
||||
|
@ -33,18 +33,18 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
this->geoData(0)->fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&this->geoData(0)->fColor);
|
||||
opt.getOverrideColorIfSet(&this->geoData(0)->fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = this->geoData(0)->fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
void generateGeometry(GrBatchTarget* batchTarget) override {
|
||||
|
@ -272,18 +272,18 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineInfo& init) override {
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
if (!opt.readsColor()) {
|
||||
fGeoData[0].fColor = GrColor_ILLEGAL;
|
||||
}
|
||||
init.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
opt.getOverrideColorIfSet(&fGeoData[0].fColor);
|
||||
|
||||
// setup batch properties
|
||||
fBatch.fColorIgnored = !init.readsColor();
|
||||
fBatch.fColorIgnored = !opt.readsColor();
|
||||
fBatch.fColor = fGeoData[0].fColor;
|
||||
fBatch.fUsesLocalCoords = init.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !init.readsCoverage();
|
||||
fBatch.fUsesLocalCoords = opt.readsLocalCoords();
|
||||
fBatch.fCoverageIgnored = !opt.readsCoverage();
|
||||
}
|
||||
|
||||
struct DashDraw {
|
||||
|
@ -909,7 +909,7 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
|
||||
}
|
||||
|
||||
const char* name() const override { return "Test LCD Text Batch"; }
|
||||
void initBatchTracker(const GrPipelineInfo&) override {}
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override {}
|
||||
bool onCombineIfPossible(GrBatch*) override { return false; }
|
||||
void generateGeometry(GrBatchTarget*) override {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user