Index: src/gpu/effects/GrConvexPolyEffect.cpp |
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp |
index 6ecba24c5f18eb6c22844a72d7daf135c5e1bc00..69c5862aa3b796fee47414b97b413a9e66db646f 100644 |
--- a/src/gpu/effects/GrConvexPolyEffect.cpp |
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp |
@@ -81,12 +81,7 @@ class GLAARectEffect : public GrGLFragmentProcessor { |
public: |
GLAARectEffect(const GrProcessor&); |
- virtual void emitCode(GrGLFPBuilder* builder, |
- const GrFragmentProcessor& fp, |
- const char* outputColor, |
- const char* inputColor, |
- const TransformedCoordsArray&, |
- const TextureSamplerArray&) override; |
+ virtual void emitCode(EmitArgs&) override; |
static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); |
@@ -102,23 +97,18 @@ GLAARectEffect::GLAARectEffect(const GrProcessor& effect) { |
fPrevRect.fLeft = SK_ScalarNaN; |
} |
-void GLAARectEffect::emitCode(GrGLFPBuilder* builder, |
- const GrFragmentProcessor& fp, |
- const char* outputColor, |
- const char* inputColor, |
- const TransformedCoordsArray&, |
- const TextureSamplerArray& samplers) { |
- const AARectEffect& aare = fp.cast<AARectEffect>(); |
+void GLAARectEffect::emitCode(EmitArgs& args) { |
+ const AARectEffect& aare = args.fFp.cast<AARectEffect>(); |
const char *rectName; |
// The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bottom - 0.5), |
// respectively. |
- fRectUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
+ fRectUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
kVec4f_GrSLType, |
kDefault_GrSLPrecision, |
"rect", |
&rectName); |
- GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
+ GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder(); |
const char* fragmentPos = fsBuilder->fragmentPosition(); |
if (GrProcessorEdgeTypeIsAA(aare.getEdgeType())) { |
// The amount of coverage removed in x and y by the edges is computed as a pair of negative |
@@ -142,8 +132,8 @@ void GLAARectEffect::emitCode(GrGLFPBuilder* builder, |
if (GrProcessorEdgeTypeIsInverseFill(aare.getEdgeType())) { |
fsBuilder->codeAppend("\t\talpha = 1.0 - alpha;\n"); |
} |
- fsBuilder->codeAppendf("\t\t%s = %s;\n", outputColor, |
- (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str()); |
+ fsBuilder->codeAppendf("\t\t%s = %s;\n", args.fOutputColor, |
+ (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str()); |
} |
void GLAARectEffect::setData(const GrGLProgramDataManager& pdman, const GrProcessor& processor) { |
@@ -176,12 +166,7 @@ class GrGLConvexPolyEffect : public GrGLFragmentProcessor { |
public: |
GrGLConvexPolyEffect(const GrProcessor&); |
- virtual void emitCode(GrGLFPBuilder* builder, |
- const GrFragmentProcessor& fp, |
- const char* outputColor, |
- const char* inputColor, |
- const TransformedCoordsArray&, |
- const TextureSamplerArray&) override; |
+ virtual void emitCode(EmitArgs&) override; |
static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); |
@@ -197,22 +182,17 @@ GrGLConvexPolyEffect::GrGLConvexPolyEffect(const GrProcessor&) { |
fPrevEdges[0] = SK_ScalarNaN; |
} |
-void GrGLConvexPolyEffect::emitCode(GrGLFPBuilder* builder, |
- const GrFragmentProcessor& fp, |
- const char* outputColor, |
- const char* inputColor, |
- const TransformedCoordsArray&, |
- const TextureSamplerArray& samplers) { |
- const GrConvexPolyEffect& cpe = fp.cast<GrConvexPolyEffect>(); |
+void GrGLConvexPolyEffect::emitCode(EmitArgs& args) { |
+ const GrConvexPolyEffect& cpe = args.fFp.cast<GrConvexPolyEffect>(); |
const char *edgeArrayName; |
- fEdgeUniform = builder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility, |
+ fEdgeUniform = args.fBuilder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility, |
kVec3f_GrSLType, |
kDefault_GrSLPrecision, |
"edges", |
cpe.getEdgeCount(), |
&edgeArrayName); |
- GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
+ GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder(); |
fsBuilder->codeAppend("\t\tfloat alpha = 1.0;\n"); |
fsBuilder->codeAppend("\t\tfloat edge;\n"); |
const char* fragmentPos = fsBuilder->fragmentPosition(); |
@@ -228,15 +208,15 @@ void GrGLConvexPolyEffect::emitCode(GrGLFPBuilder* builder, |
} |
// Woe is me. See skbug.com/2149. |
- if (kTegra2_GrGLRenderer == builder->ctxInfo().renderer()) { |
+ if (kTegra2_GrGLRenderer == args.fBuilder->ctxInfo().renderer()) { |
fsBuilder->codeAppend("\t\tif (-1.0 == alpha) {\n\t\t\tdiscard;\n\t\t}\n"); |
} |
if (GrProcessorEdgeTypeIsInverseFill(cpe.getEdgeType())) { |
fsBuilder->codeAppend("\talpha = 1.0 - alpha;\n"); |
} |
- fsBuilder->codeAppendf("\t%s = %s;\n", outputColor, |
- (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str()); |
+ fsBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor, |
+ (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str()); |
} |
void GrGLConvexPolyEffect::setData(const GrGLProgramDataManager& pdman, const GrProcessor& effect) { |