removing equality / compute invariant loops from GrGeometryProcessors
BUG=skia: Review URL: https://codereview.chromium.org/1111603004
This commit is contained in:
parent
cfc18867d9
commit
ef292a0901
@ -99,7 +99,6 @@
|
||||
'<(skia_src_path)/gpu/GrFontScaler.h',
|
||||
'<(skia_src_path)/gpu/GrGeometryBuffer.h',
|
||||
'<(skia_src_path)/gpu/GrGeometryProcessor.h',
|
||||
'<(skia_src_path)/gpu/GrGeometryProcessor.cpp',
|
||||
'<(skia_src_path)/gpu/GrGlyph.h',
|
||||
'<(skia_src_path)/gpu/GrGpu.cpp',
|
||||
'<(skia_src_path)/gpu/GrGpu.h',
|
||||
|
@ -623,17 +623,6 @@ public:
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const override {
|
||||
const BatchTracker& mine = m.cast<BatchTracker>();
|
||||
const BatchTracker& theirs = t.cast<BatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix)
|
||||
: INHERITED(color, SkMatrix::I(), localMatrix) {
|
||||
@ -642,14 +631,6 @@ private:
|
||||
fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVertexAttribType));
|
||||
}
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
struct BatchTracker {
|
||||
GrGPInput fInputColorType;
|
||||
GrColor fColor;
|
||||
|
@ -189,8 +189,7 @@ public:
|
||||
this->viewMatrix(),
|
||||
atlas->getTexture(),
|
||||
params,
|
||||
flags,
|
||||
false));
|
||||
flags));
|
||||
|
||||
this->initDraw(batchTarget, dfProcessor, pipeline);
|
||||
|
||||
|
@ -837,7 +837,6 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
|
||||
this->color(),
|
||||
*geometryProcessorViewM,
|
||||
*geometryProcessorLocalM,
|
||||
false,
|
||||
this->coverage()));
|
||||
|
||||
SkAutoTUnref<const GrGeometryProcessor> quadGP(
|
||||
|
@ -45,11 +45,11 @@ static const GrGeometryProcessor* create_fill_rect_gp(bool tweakAlphaForCoverage
|
||||
const GrGeometryProcessor* gp;
|
||||
if (tweakAlphaForCoverage) {
|
||||
gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, SkMatrix::I(), localMatrix,
|
||||
false, 0xff);
|
||||
0xff);
|
||||
} else {
|
||||
flags |= GrDefaultGeoProcFactory::kCoverage_GPType;
|
||||
gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, SkMatrix::I(), localMatrix,
|
||||
false, 0xff);
|
||||
0xff);
|
||||
}
|
||||
return gp;
|
||||
}
|
||||
|
@ -1494,14 +1494,10 @@ public:
|
||||
texture));
|
||||
} else {
|
||||
GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
|
||||
|
||||
// This will be ignored in the non A8 case
|
||||
bool opaqueVertexColors = GrColorIsOpaque(this->color());
|
||||
gp.reset(GrBitmapTextGeoProc::Create(this->color(),
|
||||
texture,
|
||||
params,
|
||||
fMaskFormat,
|
||||
opaqueVertexColors,
|
||||
localMatrix));
|
||||
}
|
||||
|
||||
@ -1964,7 +1960,6 @@ private:
|
||||
flags);
|
||||
} else {
|
||||
flags |= kColorAttr_DistanceFieldEffectFlag;
|
||||
bool opaque = GrColorIsOpaque(color);
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
U8CPU lum = SkColorSpaceLuminance::computeLuminance(fGamma, filteredColor);
|
||||
float correction = (*fDistanceAdjustTable)[lum >> kDistanceAdjustLumShift];
|
||||
@ -1973,15 +1968,13 @@ private:
|
||||
texture,
|
||||
params,
|
||||
correction,
|
||||
flags,
|
||||
opaque);
|
||||
flags);
|
||||
#else
|
||||
return GrDistanceFieldA8TextGeoProc::Create(color,
|
||||
viewMatrix,
|
||||
texture,
|
||||
params,
|
||||
flags,
|
||||
opaque);
|
||||
flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -24,13 +24,11 @@ public:
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix,
|
||||
bool opaqueVertexColors,
|
||||
uint8_t coverage) {
|
||||
return SkNEW_ARGS(DefaultGeoProc, (gpTypeFlags,
|
||||
color,
|
||||
viewMatrix,
|
||||
localMatrix,
|
||||
opaqueVertexColors,
|
||||
coverage));
|
||||
}
|
||||
|
||||
@ -60,23 +58,9 @@ public:
|
||||
} else {
|
||||
local->fInputCoverageType = kIgnored_GrGPInput;
|
||||
}
|
||||
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const override {
|
||||
const BatchTracker& mine = m.cast<BatchTracker>();
|
||||
const BatchTracker& theirs = t.cast<BatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor) &&
|
||||
CanCombineOutput(mine.fInputCoverageType, mine.fCoverage,
|
||||
theirs.fInputCoverageType, theirs.fCoverage);
|
||||
}
|
||||
|
||||
class GLProcessor : public GrGLGeometryProcessor {
|
||||
public:
|
||||
GLProcessor(const GrGeometryProcessor& gp, const GrBatchTracker&)
|
||||
@ -183,9 +167,8 @@ private:
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix,
|
||||
bool opaqueVertexColors,
|
||||
uint8_t coverage)
|
||||
: INHERITED(color, viewMatrix, localMatrix, opaqueVertexColors)
|
||||
: INHERITED(color, viewMatrix, localMatrix)
|
||||
, fInPosition(NULL)
|
||||
, fInColor(NULL)
|
||||
, fInLocalCoords(NULL)
|
||||
@ -199,7 +182,6 @@ private:
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
if (hasColor) {
|
||||
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
|
||||
this->setHasVertexColor();
|
||||
}
|
||||
if (hasLocalCoord) {
|
||||
fInLocalCoords = &this->addVertexAttrib(Attribute("inLocalCoord",
|
||||
@ -212,20 +194,6 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override {
|
||||
const DefaultGeoProc& gp = other.cast<DefaultGeoProc>();
|
||||
return gp.fFlags == this->fFlags;
|
||||
}
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
if (fInCoverage) {
|
||||
out->setUnknownSingleComponent();
|
||||
} else {
|
||||
// uniform coverage
|
||||
out->setKnownSingleComponent(this->coverage());
|
||||
}
|
||||
}
|
||||
|
||||
struct BatchTracker {
|
||||
GrGPInput fInputColorType;
|
||||
GrGPInput fInputCoverageType;
|
||||
@ -267,7 +235,6 @@ GrGeometryProcessor* DefaultGeoProc::TestCreate(SkRandom* random,
|
||||
GrRandomColor(random),
|
||||
GrProcessorUnitTest::TestMatrix(random),
|
||||
GrProcessorUnitTest::TestMatrix(random),
|
||||
random->nextBool(),
|
||||
GrRandomCoverage(random));
|
||||
}
|
||||
|
||||
@ -275,12 +242,10 @@ const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix,
|
||||
bool opaqueVertexColors,
|
||||
uint8_t coverage) {
|
||||
return DefaultGeoProc::Create(gpTypeFlags,
|
||||
color,
|
||||
viewMatrix,
|
||||
localMatrix,
|
||||
opaqueVertexColors,
|
||||
coverage);
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ public:
|
||||
GrColor,
|
||||
const SkMatrix& viewMatrix = SkMatrix::I(),
|
||||
const SkMatrix& localMatrix = SkMatrix::I(),
|
||||
bool opaqueVertexColors = false,
|
||||
uint8_t coverage = 0xff);
|
||||
|
||||
static size_t DefaultVertexStride() { return sizeof(PositionAttr); }
|
||||
|
@ -256,7 +256,6 @@ public:
|
||||
this->color(),
|
||||
this->viewMatrix(),
|
||||
SkMatrix::I(),
|
||||
false,
|
||||
this->coverage()));
|
||||
|
||||
size_t vertexStride = gp->getVertexStride();
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "GrGeometryProcessor.h"
|
||||
|
||||
#include "GrInvariantOutput.h"
|
||||
|
||||
void GrGeometryProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const {
|
||||
if (fHasVertexColor) {
|
||||
if (fOpaqueVertexColors) {
|
||||
out->setUnknownOpaqueFourComponents();
|
||||
} else {
|
||||
out->setUnknownFourComponents();
|
||||
}
|
||||
} else {
|
||||
out->setKnownFourComponents(fColor);
|
||||
}
|
||||
this->onGetInvariantOutputColor(out);
|
||||
}
|
||||
|
||||
void GrGeometryProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) const {
|
||||
this->onGetInvariantOutputCoverage(out);
|
||||
}
|
@ -23,61 +23,33 @@ public:
|
||||
// atleast bundles
|
||||
GrGeometryProcessor(GrColor color,
|
||||
const SkMatrix& viewMatrix = SkMatrix::I(),
|
||||
const SkMatrix& localMatrix = SkMatrix::I(),
|
||||
bool opaqueVertexColors = false)
|
||||
const SkMatrix& localMatrix = SkMatrix::I())
|
||||
: INHERITED(viewMatrix, localMatrix, false)
|
||||
, fColor(color)
|
||||
, fOpaqueVertexColors(opaqueVertexColors)
|
||||
, fWillUseGeoShader(false)
|
||||
, fHasVertexColor(false)
|
||||
, fHasLocalCoords(false) {}
|
||||
|
||||
bool willUseGeoShader() const { return fWillUseGeoShader; }
|
||||
|
||||
/*
|
||||
* In an ideal world, two GrGeometryProcessors with the same class id and texture accesses
|
||||
* would ALWAYS be able to batch together. If two GrGeometryProcesosrs are the same then we
|
||||
* will only keep one of them. The remaining GrGeometryProcessor then updates its
|
||||
* GrBatchTracker to incorporate the draw information from the GrGeometryProcessor we discard.
|
||||
* Any bundles associated with the discarded GrGeometryProcessor will be attached to the
|
||||
* remaining GrGeometryProcessor.
|
||||
*/
|
||||
// TODO delete this when paths are in batch
|
||||
bool canMakeEqual(const GrBatchTracker& mine,
|
||||
const GrPrimitiveProcessor& that,
|
||||
const GrBatchTracker& theirs) const override {
|
||||
if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO let the GPs decide this
|
||||
if (!this->viewMatrix().cheapEqualTo(that.viewMatrix())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO remove the hint
|
||||
const GrGeometryProcessor& other = that.cast<GrGeometryProcessor>();
|
||||
if (fHasVertexColor && fOpaqueVertexColors != other.fOpaqueVertexColors) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO this equality test should really be broken up, some of this can live on the batch
|
||||
// tracker test and some of this should be in bundles
|
||||
if (!this->onIsEqual(other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this->onCanMakeEqual(mine, other, theirs);
|
||||
SkFAIL("Unsupported\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO we can remove color from the GrGeometryProcessor base class once we have bundles of
|
||||
// primitive data
|
||||
GrColor color() const { return fColor; }
|
||||
|
||||
// TODO this is a total hack until the gp can do deferred geometry
|
||||
bool hasVertexColor() const { return fHasVertexColor; }
|
||||
|
||||
void getInvariantOutputColor(GrInitInvariantOutput* out) const override;
|
||||
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override;
|
||||
// TODO Delete when paths are in batch
|
||||
void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
|
||||
SkFAIL("Unsupported\n");
|
||||
}
|
||||
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
SkFAIL("Unsupported\n");
|
||||
}
|
||||
|
||||
protected:
|
||||
/*
|
||||
@ -128,26 +100,13 @@ protected:
|
||||
void setWillUseGeoShader() { fWillUseGeoShader = true; }
|
||||
|
||||
// TODO hack see above
|
||||
void setHasVertexColor() { fHasVertexColor = true; }
|
||||
void setHasLocalCoords() { fHasLocalCoords = true; }
|
||||
|
||||
virtual void onGetInvariantOutputColor(GrInitInvariantOutput*) const {}
|
||||
virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const = 0;
|
||||
|
||||
private:
|
||||
virtual bool onCanMakeEqual(const GrBatchTracker& mine,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& theirs) const = 0;
|
||||
|
||||
// TODO delete this when we have more advanced equality testing via bundles and the BT
|
||||
virtual bool onIsEqual(const GrGeometryProcessor&) const = 0;
|
||||
|
||||
bool hasExplicitLocalCoords() const override { return fHasLocalCoords; }
|
||||
|
||||
GrColor fColor;
|
||||
bool fOpaqueVertexColors;
|
||||
bool fWillUseGeoShader;
|
||||
bool fHasVertexColor;
|
||||
bool fHasLocalCoords;
|
||||
|
||||
typedef GrPrimitiveProcessor INHERITED;
|
||||
|
@ -46,11 +46,9 @@ static const GrGeometryProcessor* create_rect_gp(bool hasExplicitLocalCoords,
|
||||
GrDefaultGeoProcFactory::kColor_GPType;
|
||||
flags |= hasExplicitLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
|
||||
if (localMatrix) {
|
||||
return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), *localMatrix,
|
||||
GrColorIsOpaque(color));
|
||||
return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), *localMatrix);
|
||||
} else {
|
||||
return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), SkMatrix::I(),
|
||||
GrColorIsOpaque(color));
|
||||
return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), SkMatrix::I());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,17 +174,6 @@ public:
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const override {
|
||||
const BatchTracker& mine = m.cast<BatchTracker>();
|
||||
const BatchTracker& theirs = t.cast<BatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
CircleEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix)
|
||||
: INHERITED(color, SkMatrix::I(), localMatrix) {
|
||||
@ -195,15 +184,6 @@ private:
|
||||
fStroke = stroke;
|
||||
}
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override {
|
||||
const CircleEdgeEffect& cee = other.cast<CircleEdgeEffect>();
|
||||
return cee.fStroke == fStroke;
|
||||
}
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
struct BatchTracker {
|
||||
GrGPInput fInputColorType;
|
||||
GrColor fColor;
|
||||
@ -369,17 +349,6 @@ public:
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const override {
|
||||
const BatchTracker& mine = m.cast<BatchTracker>();
|
||||
const BatchTracker& theirs = t.cast<BatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
EllipseEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix)
|
||||
: INHERITED(color, SkMatrix::I(), localMatrix) {
|
||||
@ -392,15 +361,6 @@ private:
|
||||
fStroke = stroke;
|
||||
}
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override {
|
||||
const EllipseEdgeEffect& eee = other.cast<EllipseEdgeEffect>();
|
||||
return eee.fStroke == fStroke;
|
||||
}
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
struct BatchTracker {
|
||||
GrGPInput fInputColorType;
|
||||
GrColor fColor;
|
||||
@ -584,17 +544,6 @@ public:
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const override {
|
||||
const BatchTracker& mine = m.cast<BatchTracker>();
|
||||
const BatchTracker& theirs = t.cast<BatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
private:
|
||||
DIEllipseEdgeEffect(GrColor color, const SkMatrix& viewMatrix, Mode mode)
|
||||
: INHERITED(color, viewMatrix) {
|
||||
@ -607,15 +556,6 @@ private:
|
||||
fMode = mode;
|
||||
}
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override {
|
||||
const DIEllipseEdgeEffect& eee = other.cast<DIEllipseEdgeEffect>();
|
||||
return eee.fMode == fMode;
|
||||
}
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
struct BatchTracker {
|
||||
GrGPInput fInputColorType;
|
||||
GrColor fColor;
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
|
||||
void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
|
||||
// When this is called on a batch, there is only one geometry bundle
|
||||
if (fGeometryProcessor->hasVertexColor()) {
|
||||
if (fHasVertexColor) {
|
||||
out->setUnknownFourComponents();
|
||||
} else {
|
||||
out->setKnownFourComponents(fGeometryProcessor->color());
|
||||
@ -68,7 +68,8 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
GrTestBatch(const GrGeometryProcessor* gp) {
|
||||
GrTestBatch(const GrGeometryProcessor* gp, bool hasVertexColor = false)
|
||||
: fHasVertexColor(hasVertexColor) {
|
||||
fGeometryProcessor.reset(SkRef(gp));
|
||||
}
|
||||
|
||||
@ -90,6 +91,7 @@ private:
|
||||
bool fCoverageIgnored;
|
||||
};
|
||||
|
||||
bool fHasVertexColor;
|
||||
SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
|
||||
BatchTracker fBatch;
|
||||
};
|
||||
|
@ -200,11 +200,6 @@ GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
|
||||
kVec4f_GrVertexAttribType));
|
||||
}
|
||||
|
||||
bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const {
|
||||
const GrConicEffect& ce = other.cast<GrConicEffect>();
|
||||
return (ce.fEdgeType == fEdgeType);
|
||||
}
|
||||
|
||||
void GrConicEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
|
||||
ConicBatchTracker* local = bt->cast<ConicBatchTracker>();
|
||||
local->fInputColorType = GetColorInputType(&local->fColor, this->color(), init, false);
|
||||
@ -212,18 +207,6 @@ void GrConicEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& i
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool GrConicEffect::onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const {
|
||||
const ConicBatchTracker& mine = m.cast<ConicBatchTracker>();
|
||||
const ConicBatchTracker& theirs = t.cast<ConicBatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor) &&
|
||||
mine.fCoverageScale == theirs.fCoverageScale;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect);
|
||||
@ -421,11 +404,6 @@ GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
|
||||
kVec4f_GrVertexAttribType));
|
||||
}
|
||||
|
||||
bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const {
|
||||
const GrQuadEffect& ce = other.cast<GrQuadEffect>();
|
||||
return (ce.fEdgeType == fEdgeType);
|
||||
}
|
||||
|
||||
void GrQuadEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
|
||||
QuadBatchTracker* local = bt->cast<QuadBatchTracker>();
|
||||
local->fInputColorType = GetColorInputType(&local->fColor, this->color(), init, false);
|
||||
@ -433,18 +411,6 @@ void GrQuadEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& in
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool GrQuadEffect::onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const {
|
||||
const QuadBatchTracker& mine = m.cast<QuadBatchTracker>();
|
||||
const QuadBatchTracker& theirs = t.cast<QuadBatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor) &&
|
||||
mine.fCoverageScale == theirs.fCoverageScale;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect);
|
||||
@ -663,28 +629,12 @@ GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix,
|
||||
kVec4f_GrVertexAttribType));
|
||||
}
|
||||
|
||||
bool GrCubicEffect::onIsEqual(const GrGeometryProcessor& other) const {
|
||||
const GrCubicEffect& ce = other.cast<GrCubicEffect>();
|
||||
return (ce.fEdgeType == fEdgeType);
|
||||
}
|
||||
|
||||
void GrCubicEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
|
||||
CubicBatchTracker* local = bt->cast<CubicBatchTracker>();
|
||||
local->fInputColorType = GetColorInputType(&local->fColor, this->color(), init, false);
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool GrCubicEffect::onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const {
|
||||
const CubicBatchTracker& mine = m.cast<CubicBatchTracker>();
|
||||
const CubicBatchTracker& theirs = t.cast<CubicBatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect);
|
||||
|
@ -106,20 +106,11 @@ public:
|
||||
const GrGLSLCaps&) const override;
|
||||
|
||||
void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override;
|
||||
bool onCanMakeEqual(const GrBatchTracker&,
|
||||
const GrGeometryProcessor&,
|
||||
const GrBatchTracker&) const override;
|
||||
|
||||
private:
|
||||
GrConicEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType,
|
||||
const SkMatrix& localMatrix);
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override;
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
uint8_t fCoverageScale;
|
||||
GrPrimitiveEdgeType fEdgeType;
|
||||
const Attribute* fInPosition;
|
||||
@ -191,20 +182,11 @@ public:
|
||||
const GrGLSLCaps&) const override;
|
||||
|
||||
void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override;
|
||||
bool onCanMakeEqual(const GrBatchTracker&,
|
||||
const GrGeometryProcessor&,
|
||||
const GrBatchTracker&) const override;
|
||||
|
||||
private:
|
||||
GrQuadEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType,
|
||||
const SkMatrix& localMatrix);
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override;
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
uint8_t fCoverageScale;
|
||||
GrPrimitiveEdgeType fEdgeType;
|
||||
const Attribute* fInPosition;
|
||||
@ -272,19 +254,10 @@ public:
|
||||
const GrGLSLCaps&) const override;
|
||||
|
||||
void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override;
|
||||
bool onCanMakeEqual(const GrBatchTracker&,
|
||||
const GrGeometryProcessor&,
|
||||
const GrBatchTracker&) const override;
|
||||
|
||||
private:
|
||||
GrCubicEffect(GrColor, const SkMatrix& viewMatrix, GrPrimitiveEdgeType);
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override;
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
GrPrimitiveEdgeType fEdgeType;
|
||||
const Attribute* fInPosition;
|
||||
const Attribute* fInCubicCoeffs;
|
||||
|
@ -118,8 +118,8 @@ private:
|
||||
|
||||
GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
|
||||
const GrTextureParams& params, GrMaskFormat format,
|
||||
bool opaqueVertexColors, const SkMatrix& localMatrix)
|
||||
: INHERITED(color, SkMatrix::I(), localMatrix, opaqueVertexColors)
|
||||
const SkMatrix& localMatrix)
|
||||
: INHERITED(color, SkMatrix::I(), localMatrix)
|
||||
, fTextureAccess(texture, params)
|
||||
, fInColor(NULL)
|
||||
, fMaskFormat(format) {
|
||||
@ -129,40 +129,12 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
|
||||
bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat;
|
||||
if (hasVertexColor) {
|
||||
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
|
||||
this->setHasVertexColor();
|
||||
}
|
||||
fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
|
||||
kVec2s_GrVertexAttribType));
|
||||
this->addTextureAccess(&fTextureAccess);
|
||||
}
|
||||
|
||||
bool GrBitmapTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const {
|
||||
const GrBitmapTextGeoProc& gp = other.cast<GrBitmapTextGeoProc>();
|
||||
return SkToBool(this->inColor()) == SkToBool(gp.inColor());
|
||||
}
|
||||
|
||||
void GrBitmapTextGeoProc::onGetInvariantOutputColor(GrInitInvariantOutput* out) const {
|
||||
if (kARGB_GrMaskFormat == fMaskFormat) {
|
||||
out->setUnknownFourComponents();
|
||||
}
|
||||
}
|
||||
|
||||
void GrBitmapTextGeoProc::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
|
||||
if (kARGB_GrMaskFormat != fMaskFormat) {
|
||||
if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
|
||||
out->setUnknownSingleComponent();
|
||||
} else if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
|
||||
out->setUnknownOpaqueFourComponents();
|
||||
out->setUsingLCDCoverage();
|
||||
} else {
|
||||
out->setUnknownFourComponents();
|
||||
out->setUsingLCDCoverage();
|
||||
}
|
||||
} else {
|
||||
out->setKnownSingleComponent(0xff);
|
||||
}
|
||||
}
|
||||
|
||||
void GrBitmapTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
@ -182,17 +154,6 @@ void GrBitmapTextGeoProc::initBatchTracker(GrBatchTracker* bt, const GrPipelineI
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool GrBitmapTextGeoProc::onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const {
|
||||
const BitmapTextBatchTracker& mine = m.cast<BitmapTextBatchTracker>();
|
||||
const BitmapTextBatchTracker& theirs = t.cast<BitmapTextBatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc);
|
||||
@ -231,6 +192,5 @@ GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(SkRandom* random,
|
||||
}
|
||||
|
||||
return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], params,
|
||||
format, random->nextBool(),
|
||||
GrProcessorUnitTest::TestMatrix(random));
|
||||
format, GrProcessorUnitTest::TestMatrix(random));
|
||||
}
|
||||
|
@ -22,10 +22,9 @@ class GrInvariantOutput;
|
||||
class GrBitmapTextGeoProc : public GrGeometryProcessor {
|
||||
public:
|
||||
static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTextureParams& p,
|
||||
GrMaskFormat format, bool opaqueVertexColors,
|
||||
GrMaskFormat format,
|
||||
const SkMatrix& localMatrix) {
|
||||
return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, format, opaqueVertexColors,
|
||||
localMatrix));
|
||||
return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, format, localMatrix));
|
||||
}
|
||||
|
||||
virtual ~GrBitmapTextGeoProc() {}
|
||||
@ -45,19 +44,10 @@ public:
|
||||
const GrGLSLCaps& caps) const override;
|
||||
|
||||
void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override;
|
||||
bool onCanMakeEqual(const GrBatchTracker&,
|
||||
const GrGeometryProcessor&,
|
||||
const GrBatchTracker&) const override;
|
||||
|
||||
private:
|
||||
GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& params,
|
||||
GrMaskFormat format, bool opaqueVertexColors, const SkMatrix& localMatrix);
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override;
|
||||
|
||||
void onGetInvariantOutputColor(GrInitInvariantOutput*) const override;
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
|
||||
GrMaskFormat format, const SkMatrix& localMatrix);
|
||||
|
||||
GrTextureAccess fTextureAccess;
|
||||
const Attribute* fInPosition;
|
||||
|
@ -784,8 +784,6 @@ public:
|
||||
DashAAMode aaMode,
|
||||
const SkMatrix& localMatrix);
|
||||
|
||||
virtual ~DashingCircleEffect();
|
||||
|
||||
const char* name() const override { return "DashingCircleEffect"; }
|
||||
|
||||
const Attribute* inPosition() const { return fInPosition; }
|
||||
@ -805,17 +803,9 @@ public:
|
||||
|
||||
void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker&,
|
||||
const GrGeometryProcessor&,
|
||||
const GrBatchTracker&) const override;
|
||||
|
||||
private:
|
||||
DashingCircleEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix);
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override;
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
|
||||
|
||||
DashAAMode fAAMode;
|
||||
const Attribute* fInPosition;
|
||||
const Attribute* fInDashParams;
|
||||
@ -944,12 +934,6 @@ GrGeometryProcessor* DashingCircleEffect::Create(GrColor color,
|
||||
return SkNEW_ARGS(DashingCircleEffect, (color, aaMode, localMatrix));
|
||||
}
|
||||
|
||||
DashingCircleEffect::~DashingCircleEffect() {}
|
||||
|
||||
void DashingCircleEffect::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void DashingCircleEffect::getGLProcessorKey(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
@ -972,28 +956,12 @@ DashingCircleEffect::DashingCircleEffect(GrColor color,
|
||||
kVec2f_GrVertexAttribType));
|
||||
}
|
||||
|
||||
bool DashingCircleEffect::onIsEqual(const GrGeometryProcessor& other) const {
|
||||
const DashingCircleEffect& dce = other.cast<DashingCircleEffect>();
|
||||
return fAAMode == dce.fAAMode;
|
||||
}
|
||||
|
||||
void DashingCircleEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
|
||||
DashingCircleBatchTracker* local = bt->cast<DashingCircleBatchTracker>();
|
||||
local->fInputColorType = GetColorInputType(&local->fColor, this->color(), init, false);
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool DashingCircleEffect::onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const {
|
||||
const DashingCircleBatchTracker& mine = m.cast<DashingCircleBatchTracker>();
|
||||
const DashingCircleBatchTracker& theirs = t.cast<DashingCircleBatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect);
|
||||
|
||||
GrGeometryProcessor* DashingCircleEffect::TestCreate(SkRandom* random,
|
||||
@ -1032,8 +1000,6 @@ public:
|
||||
DashAAMode aaMode,
|
||||
const SkMatrix& localMatrix);
|
||||
|
||||
virtual ~DashingLineEffect();
|
||||
|
||||
const char* name() const override { return "DashingEffect"; }
|
||||
|
||||
const Attribute* inPosition() const { return fInPosition; }
|
||||
@ -1053,17 +1019,9 @@ public:
|
||||
|
||||
void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker&,
|
||||
const GrGeometryProcessor&,
|
||||
const GrBatchTracker&) const override;
|
||||
|
||||
private:
|
||||
DashingLineEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix);
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override;
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
|
||||
|
||||
DashAAMode fAAMode;
|
||||
const Attribute* fInPosition;
|
||||
const Attribute* fInDashParams;
|
||||
@ -1204,12 +1162,6 @@ GrGeometryProcessor* DashingLineEffect::Create(GrColor color,
|
||||
return SkNEW_ARGS(DashingLineEffect, (color, aaMode, localMatrix));
|
||||
}
|
||||
|
||||
DashingLineEffect::~DashingLineEffect() {}
|
||||
|
||||
void DashingLineEffect::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void DashingLineEffect::getGLProcessorKey(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
@ -1231,28 +1183,12 @@ DashingLineEffect::DashingLineEffect(GrColor color,
|
||||
fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAttribType));
|
||||
}
|
||||
|
||||
bool DashingLineEffect::onIsEqual(const GrGeometryProcessor& other) const {
|
||||
const DashingLineEffect& de = other.cast<DashingLineEffect>();
|
||||
return fAAMode == de.fAAMode;
|
||||
}
|
||||
|
||||
void DashingLineEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
|
||||
DashingLineBatchTracker* local = bt->cast<DashingLineBatchTracker>();
|
||||
local->fInputColorType = GetColorInputType(&local->fColor, this->color(), init, false);
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool DashingLineEffect::onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const {
|
||||
const DashingLineBatchTracker& mine = m.cast<DashingLineBatchTracker>();
|
||||
const DashingLineBatchTracker& theirs = t.cast<DashingLineBatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect);
|
||||
|
||||
GrGeometryProcessor* DashingLineEffect::TestCreate(SkRandom* random,
|
||||
|
@ -196,8 +196,8 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float distanceAdjust,
|
||||
#endif
|
||||
uint32_t flags, bool opaqueVertexColors)
|
||||
: INHERITED(color, viewMatrix, SkMatrix::I(), opaqueVertexColors)
|
||||
uint32_t flags)
|
||||
: INHERITED(color, viewMatrix, SkMatrix::I())
|
||||
, fTextureAccess(texture, params)
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
, fDistanceAdjust(distanceAdjust)
|
||||
@ -209,26 +209,12 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
if (flags & kColorAttr_DistanceFieldEffectFlag) {
|
||||
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
|
||||
this->setHasVertexColor();
|
||||
}
|
||||
fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
|
||||
kVec2s_GrVertexAttribType));
|
||||
this->addTextureAccess(&fTextureAccess);
|
||||
}
|
||||
|
||||
bool GrDistanceFieldA8TextGeoProc::onIsEqual(const GrGeometryProcessor& other) const {
|
||||
const GrDistanceFieldA8TextGeoProc& cte = other.cast<GrDistanceFieldA8TextGeoProc>();
|
||||
return
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
fDistanceAdjust == cte.fDistanceAdjust &&
|
||||
#endif
|
||||
fFlags == cte.fFlags;
|
||||
}
|
||||
|
||||
void GrDistanceFieldA8TextGeoProc::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void GrDistanceFieldA8TextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
@ -249,17 +235,6 @@ void GrDistanceFieldA8TextGeoProc::initBatchTracker(GrBatchTracker* bt,
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool GrDistanceFieldA8TextGeoProc::onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const {
|
||||
const DistanceFieldBatchTracker& mine = m.cast<DistanceFieldBatchTracker>();
|
||||
const DistanceFieldBatchTracker& theirs = t.cast<DistanceFieldBatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldA8TextGeoProc);
|
||||
@ -289,8 +264,7 @@ GrGeometryProcessor* GrDistanceFieldA8TextGeoProc::TestCreate(SkRandom* random,
|
||||
random->nextF(),
|
||||
#endif
|
||||
random->nextBool() ?
|
||||
kSimilarity_DistanceFieldEffectFlag : 0,
|
||||
random->nextBool());
|
||||
kSimilarity_DistanceFieldEffectFlag : 0);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -448,9 +422,8 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
|
||||
const SkMatrix& viewMatrix,
|
||||
GrTexture* texture,
|
||||
const GrTextureParams& params,
|
||||
uint32_t flags,
|
||||
bool opaqueVertexColors)
|
||||
: INHERITED(color, viewMatrix, SkMatrix::I(), opaqueVertexColors)
|
||||
uint32_t flags)
|
||||
: INHERITED(color, viewMatrix, SkMatrix::I())
|
||||
, fTextureAccess(texture, params)
|
||||
, fFlags(flags & kNonLCD_DistanceFieldEffectMask)
|
||||
, fInColor(NULL) {
|
||||
@ -459,22 +432,12 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
if (flags & kColorAttr_DistanceFieldEffectFlag) {
|
||||
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
|
||||
this->setHasVertexColor();
|
||||
}
|
||||
fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
|
||||
kVec2f_GrVertexAttribType));
|
||||
this->addTextureAccess(&fTextureAccess);
|
||||
}
|
||||
|
||||
bool GrDistanceFieldPathGeoProc::onIsEqual(const GrGeometryProcessor& other) const {
|
||||
const GrDistanceFieldPathGeoProc& cte = other.cast<GrDistanceFieldPathGeoProc>();
|
||||
return fFlags == cte.fFlags;
|
||||
}
|
||||
|
||||
void GrDistanceFieldPathGeoProc::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void GrDistanceFieldPathGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
@ -494,17 +457,6 @@ void GrDistanceFieldPathGeoProc::initBatchTracker(GrBatchTracker* bt,
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool GrDistanceFieldPathGeoProc::onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const {
|
||||
const DistanceFieldPathBatchTracker& mine = m.cast<DistanceFieldPathBatchTracker>();
|
||||
const DistanceFieldPathBatchTracker& theirs = t.cast<DistanceFieldPathBatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldPathGeoProc);
|
||||
@ -531,7 +483,7 @@ GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(SkRandom* random,
|
||||
GrProcessorUnitTest::TestMatrix(random),
|
||||
textures[texIdx],
|
||||
params,
|
||||
random->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0, random->nextBool());
|
||||
random->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -751,17 +703,6 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
|
||||
this->addTextureAccess(&fTextureAccess);
|
||||
}
|
||||
|
||||
bool GrDistanceFieldLCDTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const {
|
||||
const GrDistanceFieldLCDTextGeoProc& cte = other.cast<GrDistanceFieldLCDTextGeoProc>();
|
||||
return (fDistanceAdjust == cte.fDistanceAdjust &&
|
||||
fFlags == cte.fFlags);
|
||||
}
|
||||
|
||||
void GrDistanceFieldLCDTextGeoProc::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
|
||||
out->setUnknownFourComponents();
|
||||
out->setUsingLCDCoverage();
|
||||
}
|
||||
|
||||
void GrDistanceFieldLCDTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
@ -781,17 +722,6 @@ void GrDistanceFieldLCDTextGeoProc::initBatchTracker(GrBatchTracker* bt,
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
bool GrDistanceFieldLCDTextGeoProc::onCanMakeEqual(const GrBatchTracker& m,
|
||||
const GrGeometryProcessor& that,
|
||||
const GrBatchTracker& t) const {
|
||||
const DistanceFieldLCDBatchTracker& mine = m.cast<DistanceFieldLCDBatchTracker>();
|
||||
const DistanceFieldLCDBatchTracker& theirs = t.cast<DistanceFieldLCDBatchTracker>();
|
||||
return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
|
||||
that, theirs.fUsesLocalCoords) &&
|
||||
CanCombineOutput(mine.fInputColorType, mine.fColor,
|
||||
theirs.fInputColorType, theirs.fColor);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldLCDTextGeoProc);
|
||||
|
@ -49,16 +49,15 @@ public:
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix,
|
||||
GrTexture* tex, const GrTextureParams& params,
|
||||
float lum, uint32_t flags, bool opaqueVertexColors) {
|
||||
return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex,
|
||||
params, lum, flags, opaqueVertexColors));
|
||||
float lum, uint32_t flags) {
|
||||
return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex, params, lum,
|
||||
flags));
|
||||
}
|
||||
#else
|
||||
static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix,
|
||||
GrTexture* tex, const GrTextureParams& params,
|
||||
uint32_t flags, bool opaqueVertexColors) {
|
||||
return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex,
|
||||
params, flags, opaqueVertexColors));
|
||||
uint32_t flags) {
|
||||
return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex, params, flags));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -83,21 +82,13 @@ public:
|
||||
|
||||
void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker&,
|
||||
const GrGeometryProcessor&,
|
||||
const GrBatchTracker&) const override;
|
||||
|
||||
private:
|
||||
GrDistanceFieldA8TextGeoProc(GrColor, const SkMatrix& viewMatrix,
|
||||
GrTexture* texture, const GrTextureParams& params,
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float distanceAdjust,
|
||||
#endif
|
||||
uint32_t flags, bool opaqueVertexColors);
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override;
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
|
||||
uint32_t flags);
|
||||
|
||||
GrTextureAccess fTextureAccess;
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
@ -124,9 +115,8 @@ class GrDistanceFieldPathGeoProc : public GrGeometryProcessor {
|
||||
public:
|
||||
static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix, GrTexture* tex,
|
||||
const GrTextureParams& params,
|
||||
uint32_t flags, bool opaqueVertexColors) {
|
||||
return SkNEW_ARGS(GrDistanceFieldPathGeoProc, (color, viewMatrix, tex, params,
|
||||
flags, opaqueVertexColors));
|
||||
uint32_t flags) {
|
||||
return SkNEW_ARGS(GrDistanceFieldPathGeoProc, (color, viewMatrix, tex, params, flags));
|
||||
}
|
||||
|
||||
virtual ~GrDistanceFieldPathGeoProc() {}
|
||||
@ -147,18 +137,9 @@ public:
|
||||
|
||||
void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker&,
|
||||
const GrGeometryProcessor&,
|
||||
const GrBatchTracker&) const override;
|
||||
|
||||
private:
|
||||
GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& viewMatrix, GrTexture* texture,
|
||||
const GrTextureParams& params, uint32_t flags,
|
||||
bool opaqueVertexColors);
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override;
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
|
||||
const GrTextureParams& params, uint32_t flags);
|
||||
|
||||
GrTextureAccess fTextureAccess;
|
||||
uint32_t fFlags;
|
||||
@ -219,19 +200,11 @@ public:
|
||||
|
||||
void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
|
||||
|
||||
bool onCanMakeEqual(const GrBatchTracker&,
|
||||
const GrGeometryProcessor&,
|
||||
const GrBatchTracker&) const override;
|
||||
|
||||
private:
|
||||
GrDistanceFieldLCDTextGeoProc(GrColor, const SkMatrix& viewMatrix,
|
||||
GrTexture* texture, const GrTextureParams& params,
|
||||
DistanceAdjust wa, uint32_t flags);
|
||||
|
||||
bool onIsEqual(const GrGeometryProcessor& other) const override;
|
||||
|
||||
void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
|
||||
|
||||
GrTextureAccess fTextureAccess;
|
||||
DistanceAdjust fDistanceAdjust;
|
||||
uint32_t fFlags;
|
||||
|
Loading…
Reference in New Issue
Block a user