| Index: src/gpu/effects/GrBezierEffect.cpp
|
| diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
|
| index e846b79b2512890cf9b2ce1c09ce15535759d437..7180a2a8329f7d5e7fefb9c206cf7d212f26d520 100644
|
| --- a/src/gpu/effects/GrBezierEffect.cpp
|
| +++ b/src/gpu/effects/GrBezierEffect.cpp
|
| @@ -24,7 +24,7 @@ public:
|
| GrGLConicEffect(const GrGeometryProcessor&,
|
| const GrBatchTracker&);
|
|
|
| - virtual void emitCode(const EmitArgs&) SK_OVERRIDE;
|
| + virtual void emitCode(EmitArgs&) SK_OVERRIDE;
|
|
|
| static inline void GenKey(const GrGeometryProcessor&,
|
| const GrBatchTracker&,
|
| @@ -66,12 +66,15 @@ GrGLConicEffect::GrGLConicEffect(const GrGeometryProcessor& processor,
|
| fEdgeType = ce.getEdgeType();
|
| }
|
|
|
| -void GrGLConicEffect::emitCode(const EmitArgs& args) {
|
| +void GrGLConicEffect::emitCode(EmitArgs& args) {
|
| GrGLGPBuilder* pb = args.fPB;
|
| GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
|
| const GrConicEffect& gp = args.fGP.cast<GrConicEffect>();
|
| const ConicBatchTracker& local = args.fBT.cast<ConicBatchTracker>();
|
|
|
| + // emit attributes
|
| + vsBuilder->emitAttributes(gp);
|
| +
|
| GrGLVertToFrag v(kVec4f_GrSLType);
|
| args.fPB->addVarying("ConicCoeffs", &v);
|
| vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inConicCoeffs()->fName);
|
| @@ -80,16 +83,19 @@ void GrGLConicEffect::emitCode(const EmitArgs& args) {
|
| this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputColor, NULL,
|
| &fColorUniform);
|
|
|
| - // setup coord outputs
|
| - vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), gp.inPosition()->fName);
|
| - vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), gp.inPosition()->fName);
|
| -
|
| // setup uniform viewMatrix
|
| this->addUniformViewMatrix(pb);
|
|
|
| - // setup position varying
|
| - vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPosition(), this->uViewM(),
|
| - gp.inPosition()->fName);
|
| + // Setup position
|
| + const char* pos3 = "pos3";
|
| + vsBuilder->codeAppendf("vec3 %s;", pos3);
|
| + vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", pos3, this->uViewM(), gp.inPosition()->fName);
|
| +
|
| + // emit transforms with position
|
| + this->emitTransforms(pb, pos3, gp.inPosition()->fName, gp.localMatrix(), args.fTransformsIn,
|
| + args.fTransformsOut);
|
| +
|
| + vsBuilder->transformToNormalizedDeviceSpace(pos3);
|
|
|
| GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
|
| fsBuilder->codeAppend("float edgeAlpha;");
|
| @@ -184,7 +190,8 @@ void GrConicEffect::getGLProcessorKey(const GrBatchTracker& bt,
|
| GrGLConicEffect::GenKey(*this, bt, caps, b);
|
| }
|
|
|
| -GrGLGeometryProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt) const {
|
| +GrGLPrimitiveProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt,
|
| + const GrGLCaps&) const {
|
| return SkNEW_ARGS(GrGLConicEffect, (*this, bt));
|
| }
|
|
|
| @@ -258,7 +265,7 @@ public:
|
| GrGLQuadEffect(const GrGeometryProcessor&,
|
| const GrBatchTracker&);
|
|
|
| - virtual void emitCode(const EmitArgs&) SK_OVERRIDE;
|
| + virtual void emitCode(EmitArgs&) SK_OVERRIDE;
|
|
|
| static inline void GenKey(const GrGeometryProcessor&,
|
| const GrBatchTracker&,
|
| @@ -300,12 +307,15 @@ GrGLQuadEffect::GrGLQuadEffect(const GrGeometryProcessor& processor,
|
| fEdgeType = ce.getEdgeType();
|
| }
|
|
|
| -void GrGLQuadEffect::emitCode(const EmitArgs& args) {
|
| +void GrGLQuadEffect::emitCode(EmitArgs& args) {
|
| GrGLGPBuilder* pb = args.fPB;
|
| GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
|
| const GrQuadEffect& gp = args.fGP.cast<GrQuadEffect>();
|
| const QuadBatchTracker& local = args.fBT.cast<QuadBatchTracker>();
|
|
|
| + // emit attributes
|
| + vsBuilder->emitAttributes(gp);
|
| +
|
| GrGLVertToFrag v(kVec4f_GrSLType);
|
| args.fPB->addVarying("HairQuadEdge", &v);
|
| vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inHairQuadEdge()->fName);
|
| @@ -314,16 +324,19 @@ void GrGLQuadEffect::emitCode(const EmitArgs& args) {
|
| this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputColor, NULL,
|
| &fColorUniform);
|
|
|
| - // setup coord outputs
|
| - vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), gp.inPosition()->fName);
|
| - vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), gp.inPosition()->fName);
|
| -
|
| // setup uniform viewMatrix
|
| this->addUniformViewMatrix(pb);
|
|
|
| - // setup position varying
|
| - vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPosition(), this->uViewM(),
|
| - gp.inPosition()->fName);
|
| + // Setup position
|
| + const char* pos3 = "pos3";
|
| + vsBuilder->codeAppendf("vec3 %s;", pos3);
|
| + vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", pos3, this->uViewM(), gp.inPosition()->fName);
|
| +
|
| + // emit transforms with position
|
| + this->emitTransforms(pb, pos3, gp.inPosition()->fName, gp.localMatrix(), args.fTransformsIn,
|
| + args.fTransformsOut);
|
| +
|
| + vsBuilder->transformToNormalizedDeviceSpace(pos3);
|
|
|
| GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
|
| fsBuilder->codeAppendf("float edgeAlpha;");
|
| @@ -404,7 +417,8 @@ void GrQuadEffect::getGLProcessorKey(const GrBatchTracker& bt,
|
| GrGLQuadEffect::GenKey(*this, bt, caps, b);
|
| }
|
|
|
| -GrGLGeometryProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt) const {
|
| +GrGLPrimitiveProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt,
|
| + const GrGLCaps&) const {
|
| return SkNEW_ARGS(GrGLQuadEffect, (*this, bt));
|
| }
|
|
|
| @@ -478,7 +492,7 @@ public:
|
| GrGLCubicEffect(const GrGeometryProcessor&,
|
| const GrBatchTracker&);
|
|
|
| - virtual void emitCode(const EmitArgs&) SK_OVERRIDE;
|
| + virtual void emitCode(EmitArgs&) SK_OVERRIDE;
|
|
|
| static inline void GenKey(const GrGeometryProcessor&,
|
| const GrBatchTracker&,
|
| @@ -514,11 +528,14 @@ GrGLCubicEffect::GrGLCubicEffect(const GrGeometryProcessor& processor,
|
| fEdgeType = ce.getEdgeType();
|
| }
|
|
|
| -void GrGLCubicEffect::emitCode(const EmitArgs& args) {
|
| +void GrGLCubicEffect::emitCode(EmitArgs& args) {
|
| GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
|
| const GrCubicEffect& gp = args.fGP.cast<GrCubicEffect>();
|
| const CubicBatchTracker& local = args.fBT.cast<CubicBatchTracker>();
|
|
|
| + // emit attributes
|
| + vsBuilder->emitAttributes(gp);
|
| +
|
| GrGLVertToFrag v(kVec4f_GrSLType);
|
| args.fPB->addVarying("CubicCoeffs", &v, kHigh_GrSLPrecision);
|
| vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inCubicCoeffs()->fName);
|
| @@ -527,16 +544,19 @@ void GrGLCubicEffect::emitCode(const EmitArgs& args) {
|
| this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputColor, NULL,
|
| &fColorUniform);
|
|
|
| - // setup coord outputs
|
| - vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), gp.inPosition()->fName);
|
| - vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), gp.inPosition()->fName);
|
| -
|
| // setup uniform viewMatrix
|
| this->addUniformViewMatrix(args.fPB);
|
|
|
| - // setup position varying
|
| - vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPosition(), this->uViewM(),
|
| - gp.inPosition()->fName);
|
| + // Setup position
|
| + const char* pos3 = "pos3";
|
| + vsBuilder->codeAppendf("vec3 %s;", pos3);
|
| + vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", pos3, this->uViewM(), gp.inPosition()->fName);
|
| +
|
| + // emit transforms with position
|
| + this->emitTransforms(args.fPB, pos3, gp.inPosition()->fName, gp.localMatrix(),
|
| + args.fTransformsIn, args.fTransformsOut);
|
| +
|
| + vsBuilder->transformToNormalizedDeviceSpace(pos3);
|
|
|
| GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
|
|
|
| @@ -647,7 +667,8 @@ void GrCubicEffect::getGLProcessorKey(const GrBatchTracker& bt,
|
| GrGLCubicEffect::GenKey(*this, bt, caps, b);
|
| }
|
|
|
| -GrGLGeometryProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt) const {
|
| +GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt,
|
| + const GrGLCaps&) const {
|
| return SkNEW_ARGS(GrGLCubicEffect, (*this, bt));
|
| }
|
|
|
|
|