Remove viewmatrix from GrGeometryProcessor base class
BUG=skia: Review URL: https://codereview.chromium.org/1127953003
This commit is contained in:
parent
5b9f352ff1
commit
e578a95d3a
@ -562,7 +562,7 @@ public:
|
||||
&fColorUniform);
|
||||
|
||||
// Setup position
|
||||
this->setupPosition(pb, gpArgs, qe.inPosition()->fName, qe.viewMatrix());
|
||||
this->setupPosition(pb, gpArgs, qe.inPosition()->fName);
|
||||
|
||||
// emit transforms
|
||||
this->emitTransforms(args.fPB, gpArgs->fPositionVar, qe.inPosition()->fName,
|
||||
@ -600,15 +600,12 @@ public:
|
||||
const BatchTracker& local = bt.cast<BatchTracker>();
|
||||
uint32_t key = local.fInputColorType << 16;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 1;
|
||||
b->add32(key);
|
||||
}
|
||||
|
||||
virtual void setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& gp,
|
||||
const GrBatchTracker& bt) override {
|
||||
this->setUniformViewMatrix(pdman, gp.viewMatrix());
|
||||
|
||||
const BatchTracker& local = bt.cast<BatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
GrGLfloat c[4];
|
||||
@ -644,7 +641,7 @@ public:
|
||||
|
||||
private:
|
||||
QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix)
|
||||
: INHERITED(SkMatrix::I(), localMatrix)
|
||||
: INHERITED(localMatrix)
|
||||
, fColor(color) {
|
||||
this->initClassID<QuadEdgeEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
const Attribute* inLocalCoords() const { return fInLocalCoords; }
|
||||
const Attribute* inCoverage() const { return fInCoverage; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
uint8_t coverage() const { return fCoverage; }
|
||||
|
||||
void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override {
|
||||
@ -121,14 +122,15 @@ public:
|
||||
uint32_t key = def.fFlags;
|
||||
key |= local.fInputColorType << 8 | local.fInputCoverageType << 16;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 24 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 25;
|
||||
key |= ComputePosKey(def.viewMatrix()) << 25;
|
||||
b->add32(key);
|
||||
}
|
||||
|
||||
virtual void setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& gp,
|
||||
const GrBatchTracker& bt) override {
|
||||
this->setUniformViewMatrix(pdman, gp.viewMatrix());
|
||||
const DefaultGeoProc& dgp = gp.cast<DefaultGeoProc>();
|
||||
this->setUniformViewMatrix(pdman, dgp.viewMatrix());
|
||||
|
||||
const BatchTracker& local = bt.cast<BatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
@ -169,12 +171,13 @@ private:
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix,
|
||||
uint8_t coverage)
|
||||
: INHERITED(viewMatrix, localMatrix)
|
||||
: INHERITED(localMatrix)
|
||||
, fInPosition(NULL)
|
||||
, fInColor(NULL)
|
||||
, fInLocalCoords(NULL)
|
||||
, fInCoverage(NULL)
|
||||
, fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fCoverage(coverage)
|
||||
, fFlags(gpTypeFlags) {
|
||||
this->initClassID<DefaultGeoProc>();
|
||||
@ -209,6 +212,7 @@ private:
|
||||
const Attribute* fInLocalCoords;
|
||||
const Attribute* fInCoverage;
|
||||
GrColor fColor;
|
||||
SkMatrix fViewMatrix;
|
||||
uint8_t fCoverage;
|
||||
uint32_t fFlags;
|
||||
|
||||
|
@ -19,9 +19,8 @@
|
||||
*/
|
||||
class GrGeometryProcessor : public GrPrimitiveProcessor {
|
||||
public:
|
||||
GrGeometryProcessor(const SkMatrix& viewMatrix = SkMatrix::I(),
|
||||
const SkMatrix& localMatrix = SkMatrix::I())
|
||||
: INHERITED(viewMatrix, localMatrix, false)
|
||||
GrGeometryProcessor(const SkMatrix& localMatrix = SkMatrix::I())
|
||||
: INHERITED(localMatrix, false)
|
||||
, fWillUseGeoShader(false)
|
||||
, fHasLocalCoords(false) {}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
&fColorUniform);
|
||||
|
||||
// Setup position
|
||||
this->setupPosition(pb, gpArgs, ce.inPosition()->fName, ce.viewMatrix());
|
||||
this->setupPosition(pb, gpArgs, ce.inPosition()->fName);
|
||||
|
||||
// emit transforms
|
||||
this->emitTransforms(args.fPB, gpArgs->fPositionVar, ce.inPosition()->fName,
|
||||
@ -134,15 +134,12 @@ public:
|
||||
const CircleEdgeEffect& circleEffect = gp.cast<CircleEdgeEffect>();
|
||||
uint16_t key = circleEffect.isStroked() ? 0x1 : 0x0;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x2 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 2;
|
||||
b->add32(key << 16 | local.fInputColorType);
|
||||
}
|
||||
|
||||
virtual void setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& gp,
|
||||
const GrBatchTracker& bt) override {
|
||||
this->setUniformViewMatrix(pdman, gp.viewMatrix());
|
||||
|
||||
const BatchTracker& local = bt.cast<BatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
GrGLfloat c[4];
|
||||
@ -177,7 +174,7 @@ public:
|
||||
|
||||
private:
|
||||
CircleEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix)
|
||||
: INHERITED(SkMatrix::I(), localMatrix)
|
||||
: INHERITED(localMatrix)
|
||||
, fColor(color) {
|
||||
this->initClassID<CircleEdgeEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
@ -270,7 +267,7 @@ public:
|
||||
&fColorUniform);
|
||||
|
||||
// Setup position
|
||||
this->setupPosition(pb, gpArgs, ee.inPosition()->fName, ee.viewMatrix());
|
||||
this->setupPosition(pb, gpArgs, ee.inPosition()->fName);
|
||||
|
||||
// emit transforms
|
||||
this->emitTransforms(args.fPB, gpArgs->fPositionVar, ee.inPosition()->fName,
|
||||
@ -311,14 +308,12 @@ public:
|
||||
const EllipseEdgeEffect& ellipseEffect = gp.cast<EllipseEdgeEffect>();
|
||||
uint16_t key = ellipseEffect.isStroked() ? 0x1 : 0x0;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x2 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 2;
|
||||
b->add32(key << 16 | local.fInputColorType);
|
||||
}
|
||||
|
||||
virtual void setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& gp,
|
||||
const GrBatchTracker& bt) override {
|
||||
this->setUniformViewMatrix(pdman, gp.viewMatrix());
|
||||
|
||||
const BatchTracker& local = bt.cast<BatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
@ -355,7 +350,7 @@ public:
|
||||
|
||||
private:
|
||||
EllipseEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix)
|
||||
: INHERITED(SkMatrix::I(), localMatrix)
|
||||
: INHERITED(localMatrix)
|
||||
, fColor(color) {
|
||||
this->initClassID<EllipseEdgeEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
@ -421,6 +416,7 @@ public:
|
||||
const Attribute* inEllipseOffsets0() const { return fInEllipseOffsets0; }
|
||||
const Attribute* inEllipseOffsets1() const { return fInEllipseOffsets1; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
|
||||
inline Mode getMode() const { return fMode; }
|
||||
|
||||
@ -509,14 +505,15 @@ public:
|
||||
const DIEllipseEdgeEffect& ellipseEffect = gp.cast<DIEllipseEdgeEffect>();
|
||||
uint16_t key = ellipseEffect.getMode();
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 8 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 9;
|
||||
key |= ComputePosKey(ellipseEffect.viewMatrix()) << 9;
|
||||
b->add32(key << 16 | local.fInputColorType);
|
||||
}
|
||||
|
||||
virtual void setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& gp,
|
||||
const GrBatchTracker& bt) override {
|
||||
this->setUniformViewMatrix(pdman, gp.viewMatrix());
|
||||
const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>();
|
||||
this->setUniformViewMatrix(pdman, dee.viewMatrix());
|
||||
|
||||
const BatchTracker& local = bt.cast<BatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
@ -553,8 +550,8 @@ public:
|
||||
|
||||
private:
|
||||
DIEllipseEdgeEffect(GrColor color, const SkMatrix& viewMatrix, Mode mode)
|
||||
: INHERITED(viewMatrix)
|
||||
, fColor(color) {
|
||||
: fColor(color)
|
||||
, fViewMatrix(viewMatrix) {
|
||||
this->initClassID<DIEllipseEdgeEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInEllipseOffsets0 = &this->addVertexAttrib(Attribute("inEllipseOffsets0",
|
||||
@ -574,6 +571,7 @@ private:
|
||||
const Attribute* fInEllipseOffsets0;
|
||||
const Attribute* fInEllipseOffsets1;
|
||||
GrColor fColor;
|
||||
SkMatrix fViewMatrix;
|
||||
Mode fMode;
|
||||
|
||||
GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
|
||||
|
@ -13,7 +13,8 @@
|
||||
GrPathProcessor::GrPathProcessor(GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix& localMatrix)
|
||||
: INHERITED(viewMatrix, localMatrix, true)
|
||||
: INHERITED(localMatrix, true)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fColor(color) {
|
||||
this->initClassID<GrPathProcessor>();
|
||||
}
|
||||
@ -48,7 +49,8 @@ bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this->viewMatrix().cheapEqualTo(that.viewMatrix())) {
|
||||
const GrPathProcessor& other = that.cast<GrPathProcessor>();
|
||||
if (!this->viewMatrix().cheapEqualTo(other.viewMatrix())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
|
||||
const char* name() const override { return "PathProcessor"; }
|
||||
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
GrColor color() const { return fColor; }
|
||||
|
||||
void getInvariantOutputColor(GrInitInvariantOutput* out) const override;
|
||||
@ -51,12 +52,11 @@ public:
|
||||
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps) const override;
|
||||
|
||||
protected:
|
||||
GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
|
||||
|
||||
private:
|
||||
GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
|
||||
bool hasExplicitLocalCoords() const override { return false; }
|
||||
|
||||
const SkMatrix fViewMatrix;
|
||||
GrColor fColor;
|
||||
|
||||
typedef GrPrimitiveProcessor INHERITED;
|
||||
|
@ -104,7 +104,6 @@ class GrPrimitiveProcessor : public GrProcessor {
|
||||
public:
|
||||
// TODO let the PrimProc itself set this in its setData call, this should really live on the
|
||||
// bundle of primitive data
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
const SkMatrix& localMatrix() const { return fLocalMatrix; }
|
||||
|
||||
virtual void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const = 0;
|
||||
@ -174,11 +173,9 @@ public:
|
||||
bool isPathRendering() const { return fIsPathRendering; }
|
||||
|
||||
protected:
|
||||
GrPrimitiveProcessor(const SkMatrix& viewMatrix, const SkMatrix& localMatrix,
|
||||
bool isPathRendering)
|
||||
GrPrimitiveProcessor(const SkMatrix& localMatrix, bool isPathRendering)
|
||||
: fNumAttribs(0)
|
||||
, fVertexStride(0)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fLocalMatrix(localMatrix)
|
||||
, fIsPathRendering(isPathRendering) {}
|
||||
|
||||
@ -219,7 +216,6 @@ protected:
|
||||
private:
|
||||
virtual bool hasExplicitLocalCoords() const = 0;
|
||||
|
||||
const SkMatrix fViewMatrix;
|
||||
SkMatrix fLocalMatrix;
|
||||
bool fIsPathRendering;
|
||||
|
||||
|
@ -34,7 +34,8 @@ public:
|
||||
virtual void setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& primProc,
|
||||
const GrBatchTracker& bt) override {
|
||||
this->setUniformViewMatrix(pdman, primProc.viewMatrix());
|
||||
const GrConicEffect& ce = primProc.cast<GrConicEffect>();
|
||||
this->setUniformViewMatrix(pdman, ce.viewMatrix());
|
||||
|
||||
const ConicBatchTracker& local = bt.cast<ConicBatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
@ -170,7 +171,7 @@ void GrGLConicEffect::GenKey(const GrGeometryProcessor& gp,
|
||||
key |= kUniform_GrGPInput == local.fInputColorType ? 0x4 : 0x0;
|
||||
key |= 0xff != local.fCoverageScale ? 0x8 : 0x0;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x10 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 5;
|
||||
key |= ComputePosKey(ce.viewMatrix()) << 5;
|
||||
b->add32(key);
|
||||
}
|
||||
|
||||
@ -191,8 +192,9 @@ GrGLPrimitiveProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt
|
||||
|
||||
GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
|
||||
GrPrimitiveEdgeType edgeType, const SkMatrix& localMatrix)
|
||||
: INHERITED(viewMatrix, localMatrix)
|
||||
: INHERITED(localMatrix)
|
||||
, fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fCoverageScale(coverage)
|
||||
, fEdgeType(edgeType) {
|
||||
this->initClassID<GrConicEffect>();
|
||||
@ -253,7 +255,8 @@ public:
|
||||
virtual void setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& primProc,
|
||||
const GrBatchTracker& bt) override {
|
||||
this->setUniformViewMatrix(pdman, primProc.viewMatrix());
|
||||
const GrQuadEffect& qe = primProc.cast<GrQuadEffect>();
|
||||
this->setUniformViewMatrix(pdman, qe.viewMatrix());
|
||||
|
||||
const QuadBatchTracker& local = bt.cast<QuadBatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
@ -375,7 +378,7 @@ void GrGLQuadEffect::GenKey(const GrGeometryProcessor& gp,
|
||||
key |= kUniform_GrGPInput == local.fInputColorType ? 0x4 : 0x0;
|
||||
key |= 0xff != local.fCoverageScale ? 0x8 : 0x0;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x10 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 5;
|
||||
key |= ComputePosKey(ce.viewMatrix()) << 5;
|
||||
b->add32(key);
|
||||
}
|
||||
|
||||
@ -396,8 +399,9 @@ GrGLPrimitiveProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt,
|
||||
|
||||
GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
|
||||
GrPrimitiveEdgeType edgeType, const SkMatrix& localMatrix)
|
||||
: INHERITED(viewMatrix, localMatrix)
|
||||
: INHERITED(localMatrix)
|
||||
, fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fCoverageScale(coverage)
|
||||
, fEdgeType(edgeType) {
|
||||
this->initClassID<GrQuadEffect>();
|
||||
@ -458,7 +462,8 @@ public:
|
||||
virtual void setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& primProc,
|
||||
const GrBatchTracker& bt) override {
|
||||
this->setUniformViewMatrix(pdman, primProc.viewMatrix());
|
||||
const GrCubicEffect& ce = primProc.cast<GrCubicEffect>();
|
||||
this->setUniformViewMatrix(pdman, ce.viewMatrix());
|
||||
|
||||
const CubicBatchTracker& local = bt.cast<CubicBatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
@ -603,7 +608,7 @@ void GrGLCubicEffect::GenKey(const GrGeometryProcessor& gp,
|
||||
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
|
||||
key |= kUniform_GrGPInput == local.fInputColorType ? 0x4 : 0x8;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x10 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 5;
|
||||
key |= ComputePosKey(ce.viewMatrix()) << 5;
|
||||
b->add32(key);
|
||||
}
|
||||
|
||||
@ -624,8 +629,8 @@ GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt
|
||||
|
||||
GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix,
|
||||
GrPrimitiveEdgeType edgeType)
|
||||
: INHERITED(viewMatrix)
|
||||
, fColor(color)
|
||||
: fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fEdgeType(edgeType) {
|
||||
this->initClassID<GrCubicEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
|
@ -98,6 +98,7 @@ public:
|
||||
inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
|
||||
inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
|
||||
virtual void getGLProcessorKey(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps,
|
||||
@ -113,6 +114,7 @@ private:
|
||||
const SkMatrix& localMatrix);
|
||||
|
||||
GrColor fColor;
|
||||
SkMatrix fViewMatrix;
|
||||
uint8_t fCoverageScale;
|
||||
GrPrimitiveEdgeType fEdgeType;
|
||||
const Attribute* fInPosition;
|
||||
@ -176,6 +178,7 @@ public:
|
||||
inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
|
||||
inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
|
||||
virtual void getGLProcessorKey(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps,
|
||||
@ -191,6 +194,7 @@ private:
|
||||
const SkMatrix& localMatrix);
|
||||
|
||||
GrColor fColor;
|
||||
SkMatrix fViewMatrix;
|
||||
uint8_t fCoverageScale;
|
||||
GrPrimitiveEdgeType fEdgeType;
|
||||
const Attribute* fInPosition;
|
||||
@ -250,6 +254,7 @@ public:
|
||||
inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
|
||||
inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
|
||||
virtual void getGLProcessorKey(const GrBatchTracker& bt,
|
||||
const GrGLSLCaps& caps,
|
||||
@ -264,6 +269,7 @@ private:
|
||||
GrCubicEffect(GrColor, const SkMatrix& viewMatrix, GrPrimitiveEdgeType);
|
||||
|
||||
GrColor fColor;
|
||||
SkMatrix fViewMatrix;
|
||||
GrPrimitiveEdgeType fEdgeType;
|
||||
const Attribute* fInPosition;
|
||||
const Attribute* fInCubicCoeffs;
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
&fColorUniform);
|
||||
|
||||
// Setup position
|
||||
this->setupPosition(pb, gpArgs, cte.inPosition()->fName, cte.viewMatrix());
|
||||
this->setupPosition(pb, gpArgs, cte.inPosition()->fName);
|
||||
|
||||
// emit transforms
|
||||
this->emitTransforms(args.fPB, gpArgs->fPositionVar, cte.inPosition()->fName,
|
||||
@ -79,8 +79,6 @@ public:
|
||||
virtual void setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& gp,
|
||||
const GrBatchTracker& bt) override {
|
||||
this->setUniformViewMatrix(pdman, gp.viewMatrix());
|
||||
|
||||
const BitmapTextBatchTracker& local = bt.cast<BitmapTextBatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
GrGLfloat c[4];
|
||||
@ -103,7 +101,6 @@ public:
|
||||
key |= SkToBool(gp.inColor()) ? 0x1 : 0x0;
|
||||
key |= local.fUsesLocalCoords && proc.localMatrix().hasPerspective() ? 0x2 : 0x0;
|
||||
key |= gp.maskFormat() == kARGB_GrMaskFormat ? 0x4 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 3;
|
||||
b->add32(local.fInputColorType << 16 | key);
|
||||
}
|
||||
|
||||
@ -119,7 +116,7 @@ private:
|
||||
GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
|
||||
const GrTextureParams& params, GrMaskFormat format,
|
||||
const SkMatrix& localMatrix)
|
||||
: INHERITED(SkMatrix::I(), localMatrix)
|
||||
: INHERITED(localMatrix)
|
||||
, fColor(color)
|
||||
, fTextureAccess(texture, params)
|
||||
, fInColor(NULL)
|
||||
|
@ -866,7 +866,7 @@ void GLDashingCircleEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor, NULL, &fColorUniform);
|
||||
|
||||
// Setup position
|
||||
this->setupPosition(pb, gpArgs, dce.inPosition()->fName, dce.viewMatrix());
|
||||
this->setupPosition(pb, gpArgs, dce.inPosition()->fName);
|
||||
|
||||
// emit transforms
|
||||
this->emitTransforms(args.fPB, gpArgs->fPositionVar, dce.inPosition()->fName, dce.localMatrix(),
|
||||
@ -894,8 +894,6 @@ void GLDashingCircleEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& processor,
|
||||
const GrBatchTracker& bt) {
|
||||
this->setUniformViewMatrix(pdman, processor.viewMatrix());
|
||||
|
||||
const DashingCircleBatchTracker& local = bt.cast<DashingCircleBatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
GrGLfloat c[4];
|
||||
@ -913,7 +911,6 @@ void GLDashingCircleEffect::GenKey(const GrGeometryProcessor& gp,
|
||||
const DashingCircleEffect& dce = gp.cast<DashingCircleEffect>();
|
||||
uint32_t key = 0;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 1;
|
||||
key |= dce.aaMode() << 8;
|
||||
b->add32(key << 16 | local.fInputColorType);
|
||||
}
|
||||
@ -940,7 +937,7 @@ GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTrack
|
||||
DashingCircleEffect::DashingCircleEffect(GrColor color,
|
||||
DashAAMode aaMode,
|
||||
const SkMatrix& localMatrix)
|
||||
: INHERITED(SkMatrix::I(), localMatrix)
|
||||
: INHERITED(localMatrix)
|
||||
, fColor(color)
|
||||
, fAAMode(aaMode) {
|
||||
this->initClassID<DashingCircleEffect>();
|
||||
@ -1082,7 +1079,7 @@ void GLDashingLineEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor, NULL, &fColorUniform);
|
||||
|
||||
// Setup position
|
||||
this->setupPosition(pb, gpArgs, de.inPosition()->fName, de.viewMatrix());
|
||||
this->setupPosition(pb, gpArgs, de.inPosition()->fName);
|
||||
|
||||
// emit transforms
|
||||
this->emitTransforms(args.fPB, gpArgs->fPositionVar, de.inPosition()->fName, de.localMatrix(),
|
||||
@ -1127,8 +1124,6 @@ void GLDashingLineEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman,
|
||||
const GrPrimitiveProcessor& processor,
|
||||
const GrBatchTracker& bt) {
|
||||
this->setUniformViewMatrix(pdman, processor.viewMatrix());
|
||||
|
||||
const DashingLineBatchTracker& local = bt.cast<DashingLineBatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
GrGLfloat c[4];
|
||||
@ -1146,7 +1141,6 @@ void GLDashingLineEffect::GenKey(const GrGeometryProcessor& gp,
|
||||
const DashingLineEffect& de = gp.cast<DashingLineEffect>();
|
||||
uint32_t key = 0;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 : 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 1;
|
||||
key |= de.aaMode() << 8;
|
||||
b->add32(key << 16 | local.fInputColorType);
|
||||
}
|
||||
@ -1173,7 +1167,7 @@ GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker
|
||||
DashingLineEffect::DashingLineEffect(GrColor color,
|
||||
DashAAMode aaMode,
|
||||
const SkMatrix& localMatrix)
|
||||
: INHERITED(SkMatrix::I(), localMatrix)
|
||||
: INHERITED(localMatrix)
|
||||
, fColor(color)
|
||||
, fAAMode(aaMode) {
|
||||
this->initClassID<DashingLineEffect>();
|
||||
|
@ -152,7 +152,8 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
this->setUniformViewMatrix(pdman, proc.viewMatrix());
|
||||
const GrDistanceFieldA8TextGeoProc& dfa8gp = proc.cast<GrDistanceFieldA8TextGeoProc>();
|
||||
this->setUniformViewMatrix(pdman, dfa8gp.viewMatrix());
|
||||
|
||||
const DistanceFieldBatchTracker& local = bt.cast<DistanceFieldBatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
@ -172,7 +173,7 @@ public:
|
||||
uint32_t key = dfTexEffect.getFlags();
|
||||
key |= local.fInputColorType << 16;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 24: 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 25;
|
||||
key |= ComputePosKey(dfTexEffect.viewMatrix()) << 25;
|
||||
b->add32(key);
|
||||
}
|
||||
|
||||
@ -197,8 +198,9 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
|
||||
float distanceAdjust,
|
||||
#endif
|
||||
uint32_t flags)
|
||||
: INHERITED(viewMatrix, SkMatrix::I())
|
||||
: INHERITED(SkMatrix::I())
|
||||
, fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fTextureAccess(texture, params)
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
, fDistanceAdjust(distanceAdjust)
|
||||
@ -382,7 +384,8 @@ public:
|
||||
SkIntToScalar(fTextureSize.height()));
|
||||
}
|
||||
|
||||
this->setUniformViewMatrix(pdman, proc.viewMatrix());
|
||||
const GrDistanceFieldPathGeoProc& dfpgp = proc.cast<GrDistanceFieldPathGeoProc>();
|
||||
this->setUniformViewMatrix(pdman, dfpgp.viewMatrix());
|
||||
|
||||
const DistanceFieldPathBatchTracker& local = bt.cast<DistanceFieldPathBatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
@ -403,7 +406,7 @@ public:
|
||||
uint32_t key = dfTexEffect.getFlags();
|
||||
key |= local.fInputColorType << 16;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 24: 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 25;
|
||||
key |= ComputePosKey(dfTexEffect.viewMatrix()) << 25;
|
||||
b->add32(key);
|
||||
}
|
||||
|
||||
@ -424,8 +427,9 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
|
||||
GrTexture* texture,
|
||||
const GrTextureParams& params,
|
||||
uint32_t flags)
|
||||
: INHERITED(viewMatrix, SkMatrix::I())
|
||||
: INHERITED(SkMatrix::I())
|
||||
, fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fTextureAccess(texture, params)
|
||||
, fFlags(flags & kNonLCD_DistanceFieldEffectMask)
|
||||
, fInColor(NULL) {
|
||||
@ -652,7 +656,7 @@ public:
|
||||
fDistanceAdjust = wa;
|
||||
}
|
||||
|
||||
this->setUniformViewMatrix(pdman, processor.viewMatrix());
|
||||
this->setUniformViewMatrix(pdman, dfTexEffect.viewMatrix());
|
||||
|
||||
const DistanceFieldLCDBatchTracker& local = bt.cast<DistanceFieldLCDBatchTracker>();
|
||||
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
|
||||
@ -673,7 +677,7 @@ public:
|
||||
uint32_t key = dfTexEffect.getFlags();
|
||||
key |= local.fInputColorType << 16;
|
||||
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 24: 0x0;
|
||||
key |= ComputePosKey(gp.viewMatrix()) << 25;
|
||||
key |= ComputePosKey(dfTexEffect.viewMatrix()) << 25;
|
||||
b->add32(key);
|
||||
}
|
||||
|
||||
@ -693,8 +697,9 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
|
||||
GrTexture* texture, const GrTextureParams& params,
|
||||
DistanceAdjust distanceAdjust,
|
||||
uint32_t flags)
|
||||
: INHERITED(viewMatrix, SkMatrix::I())
|
||||
: INHERITED(SkMatrix::I())
|
||||
, fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fTextureAccess(texture, params)
|
||||
, fDistanceAdjust(distanceAdjust)
|
||||
, fFlags(flags & kLCD_DistanceFieldEffectMask){
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
const Attribute* inColor() const { return fInColor; }
|
||||
const Attribute* inTextureCoords() const { return fInTextureCoords; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float getDistanceAdjust() const { return fDistanceAdjust; }
|
||||
#endif
|
||||
@ -92,6 +93,7 @@ private:
|
||||
uint32_t flags);
|
||||
|
||||
GrColor fColor;
|
||||
SkMatrix fViewMatrix;
|
||||
GrTextureAccess fTextureAccess;
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float fDistanceAdjust;
|
||||
@ -129,6 +131,7 @@ public:
|
||||
const Attribute* inColor() const { return fInColor; }
|
||||
const Attribute* inTextureCoords() const { return fInTextureCoords; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
uint32_t getFlags() const { return fFlags; }
|
||||
|
||||
virtual void getGLProcessorKey(const GrBatchTracker& bt,
|
||||
@ -145,6 +148,7 @@ private:
|
||||
const GrTextureParams& params, uint32_t flags);
|
||||
|
||||
GrColor fColor;
|
||||
SkMatrix fViewMatrix;
|
||||
GrTextureAccess fTextureAccess;
|
||||
uint32_t fFlags;
|
||||
const Attribute* fInPosition;
|
||||
@ -194,6 +198,7 @@ public:
|
||||
const Attribute* inTextureCoords() const { return fInTextureCoords; }
|
||||
DistanceAdjust getDistanceAdjust() const { return fDistanceAdjust; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
uint32_t getFlags() const { return fFlags; }
|
||||
|
||||
virtual void getGLProcessorKey(const GrBatchTracker& bt,
|
||||
@ -211,6 +216,7 @@ private:
|
||||
DistanceAdjust wa, uint32_t flags);
|
||||
|
||||
GrColor fColor;
|
||||
SkMatrix fViewMatrix;
|
||||
GrTextureAccess fTextureAccess;
|
||||
DistanceAdjust fDistanceAdjust;
|
||||
uint32_t fFlags;
|
||||
|
@ -54,7 +54,7 @@ protected:
|
||||
void setupPosition(GrGLGPBuilder* pb,
|
||||
GrGPArgs* gpArgs,
|
||||
const char* posName,
|
||||
const SkMatrix& mat);
|
||||
const SkMatrix& mat = SkMatrix::I());
|
||||
|
||||
static uint32_t ComputePosKey(const SkMatrix& mat) {
|
||||
if (mat.isIdentity()) {
|
||||
|
@ -206,6 +206,7 @@ void GrGLNvprProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primPro
|
||||
const GrRenderTarget* rt = pipeline.getRenderTarget();
|
||||
SkISize size;
|
||||
size.set(rt->width(), rt->height());
|
||||
fGpu->glPathRendering()->setProjectionMatrix(primProc.viewMatrix(),
|
||||
const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
|
||||
fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(),
|
||||
size, rt->origin());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user