aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2014-12-03 15:34:20 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-03 15:34:20 -0800
commitc3a6eb23483e5d28073b509a5f637f41660de294 (patch)
tree0d54fe4d853cd53460b1229006c20d99989216ac /src/gpu/effects
parent829e1b80b1020b17f2078020c990e079b70c077c (diff)
create and thread batch tracker object
I remove the factory on the next CL BUG=skia: Review URL: https://codereview.chromium.org/772513002
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrBezierEffect.cpp64
-rw-r--r--src/gpu/effects/GrCustomCoordsTextureEffect.cpp11
-rw-r--r--src/gpu/effects/GrDashingEffect.cpp48
-rwxr-xr-xsrc/gpu/effects/GrDistanceFieldTextureEffect.cpp38
4 files changed, 115 insertions, 46 deletions
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 1b14d349dd..0bcfc75bef 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -15,13 +15,20 @@
class GrGLConicEffect : public GrGLGeometryProcessor {
public:
- GrGLConicEffect(const GrBackendProcessorFactory&, const GrProcessor&);
+ GrGLConicEffect(const GrBackendProcessorFactory&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&);
virtual void emitCode(const EmitArgs&) SK_OVERRIDE;
- static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
+ static inline void GenKey(const GrGeometryProcessor&,
+ const GrBatchTracker&,
+ const GrGLCaps&,
+ GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&) SK_OVERRIDE {}
private:
GrPrimitiveEdgeType fEdgeType;
@@ -30,9 +37,10 @@ private:
};
GrGLConicEffect::GrGLConicEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor& effect)
+ const GrGeometryProcessor& processor,
+ const GrBatchTracker& bt)
: INHERITED (factory) {
- const GrConicEffect& ce = effect.cast<GrConicEffect>();
+ const GrConicEffect& ce = processor.cast<GrConicEffect>();
fEdgeType = ce.getEdgeType();
}
@@ -112,7 +120,9 @@ void GrGLConicEffect::emitCode(const EmitArgs& args) {
fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage);
}
-void GrGLConicEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+void GrGLConicEffect::GenKey(const GrGeometryProcessor& processor,
+ const GrBatchTracker&,
+ const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const GrConicEffect& ce = processor.cast<GrConicEffect>();
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
@@ -162,13 +172,20 @@ GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random,
class GrGLQuadEffect : public GrGLGeometryProcessor {
public:
- GrGLQuadEffect(const GrBackendProcessorFactory&, const GrProcessor&);
+ GrGLQuadEffect(const GrBackendProcessorFactory&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&);
virtual void emitCode(const EmitArgs&) SK_OVERRIDE;
- static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
+ static inline void GenKey(const GrGeometryProcessor&,
+ const GrBatchTracker&,
+ const GrGLCaps&,
+ GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&) SK_OVERRIDE {}
private:
GrPrimitiveEdgeType fEdgeType;
@@ -177,9 +194,10 @@ private:
};
GrGLQuadEffect::GrGLQuadEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor& effect)
+ const GrGeometryProcessor& processor,
+ const GrBatchTracker& bt)
: INHERITED (factory) {
- const GrQuadEffect& ce = effect.cast<GrQuadEffect>();
+ const GrQuadEffect& ce = processor.cast<GrQuadEffect>();
fEdgeType = ce.getEdgeType();
}
@@ -245,7 +263,9 @@ void GrGLQuadEffect::emitCode(const EmitArgs& args) {
fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage);
}
-void GrGLQuadEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+void GrGLQuadEffect::GenKey(const GrGeometryProcessor& processor,
+ const GrBatchTracker&,
+ const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const GrQuadEffect& ce = processor.cast<GrQuadEffect>();
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
@@ -295,13 +315,20 @@ GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random,
class GrGLCubicEffect : public GrGLGeometryProcessor {
public:
- GrGLCubicEffect(const GrBackendProcessorFactory&, const GrProcessor&);
+ GrGLCubicEffect(const GrBackendProcessorFactory&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&);
virtual void emitCode(const EmitArgs&) SK_OVERRIDE;
- static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
+ static inline void GenKey(const GrGeometryProcessor&,
+ const GrBatchTracker&,
+ const GrGLCaps&,
+ GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&) SK_OVERRIDE {}
private:
GrPrimitiveEdgeType fEdgeType;
@@ -310,7 +337,8 @@ private:
};
GrGLCubicEffect::GrGLCubicEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor& processor)
+ const GrGeometryProcessor& processor,
+ const GrBatchTracker&)
: INHERITED (factory) {
const GrCubicEffect& ce = processor.cast<GrCubicEffect>();
fEdgeType = ce.getEdgeType();
@@ -419,7 +447,9 @@ void GrGLCubicEffect::emitCode(const EmitArgs& args) {
fsBuilder->codeAppendf("%s = vec4(%s);", args.fOutputCoverage, edgeAlpha.c_str());
}
-void GrGLCubicEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+void GrGLCubicEffect::GenKey(const GrGeometryProcessor& processor,
+ const GrBatchTracker&,
+ const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const GrCubicEffect& ce = processor.cast<GrCubicEffect>();
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
index 45c3008889..637d442d13 100644
--- a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
+++ b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
@@ -17,7 +17,9 @@
class GrGLCustomCoordsTextureEffect : public GrGLGeometryProcessor {
public:
- GrGLCustomCoordsTextureEffect(const GrBackendProcessorFactory& factory, const GrProcessor&)
+ GrGLCustomCoordsTextureEffect(const GrBackendProcessorFactory& factory,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&)
: INHERITED (factory) {}
virtual void emitCode(const EmitArgs& args) SK_OVERRIDE {
@@ -49,9 +51,12 @@ public:
}
virtual void setData(const GrGLProgramDataManager&,
- const GrProcessor&) SK_OVERRIDE {}
+ const GrGeometryProcessor&,
+ const GrBatchTracker&) SK_OVERRIDE {}
- static inline void GenKey(const GrProcessor& proc, const GrGLCaps&,
+ static inline void GenKey(const GrGeometryProcessor& proc,
+ const GrBatchTracker&,
+ const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const GrCustomCoordsTextureEffect& gp = proc.cast<GrCustomCoordsTextureEffect>();
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 95760e62e5..fec1551ef5 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -504,13 +504,20 @@ private:
class GLDashingCircleEffect : public GrGLGeometryProcessor {
public:
- GLDashingCircleEffect(const GrBackendProcessorFactory&, const GrProcessor&);
+ GLDashingCircleEffect(const GrBackendProcessorFactory&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&);
virtual void emitCode(const EmitArgs&) SK_OVERRIDE;
- static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
+ static inline void GenKey(const GrGeometryProcessor&,
+ const GrBatchTracker&,
+ const GrGLCaps&,
+ GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fParamUniform;
@@ -521,7 +528,8 @@ private:
};
GLDashingCircleEffect::GLDashingCircleEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor&)
+ const GrGeometryProcessor&,
+ const GrBatchTracker&)
: INHERITED (factory) {
fPrevRadius = SK_ScalarMin;
fPrevCenterX = SK_ScalarMin;
@@ -570,8 +578,9 @@ void GLDashingCircleEffect::emitCode(const EmitArgs& args) {
fsBuilder->codeAppendf("%s = vec4(alpha);", args.fOutputCoverage);
}
-void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman
- , const GrProcessor& processor) {
+void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman,
+ const GrGeometryProcessor& processor,
+ const GrBatchTracker&) {
const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>();
SkScalar radius = dce.getRadius();
SkScalar centerX = dce.getCenterX();
@@ -584,7 +593,9 @@ void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman
}
}
-void GLDashingCircleEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+void GLDashingCircleEffect::GenKey(const GrGeometryProcessor& processor,
+ const GrBatchTracker&,
+ const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>();
b->add32(dce.getEdgeType());
@@ -712,13 +723,20 @@ private:
class GLDashingLineEffect : public GrGLGeometryProcessor {
public:
- GLDashingLineEffect(const GrBackendProcessorFactory&, const GrProcessor&);
+ GLDashingLineEffect(const GrBackendProcessorFactory&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&);
virtual void emitCode(const EmitArgs&) SK_OVERRIDE;
- static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
+ static inline void GenKey(const GrGeometryProcessor&,
+ const GrBatchTracker&,
+ const GrGLCaps&,
+ GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fRectUniform;
@@ -729,7 +747,8 @@ private:
};
GLDashingLineEffect::GLDashingLineEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor&)
+ const GrGeometryProcessor&,
+ const GrBatchTracker&)
: INHERITED (factory) {
fPrevRect.fLeft = SK_ScalarNaN;
fPrevIntervalLength = SK_ScalarMax;
@@ -792,7 +811,8 @@ void GLDashingLineEffect::emitCode(const EmitArgs& args) {
}
void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrGeometryProcessor& processor,
+ const GrBatchTracker&) {
const DashingLineEffect& de = processor.cast<DashingLineEffect>();
const SkRect& rect = de.getRect();
SkScalar intervalLength = de.getIntervalLength();
@@ -805,7 +825,9 @@ void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman,
}
}
-void GLDashingLineEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+void GLDashingLineEffect::GenKey(const GrGeometryProcessor& processor,
+ const GrBatchTracker&,
+ const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const DashingLineEffect& de = processor.cast<DashingLineEffect>();
b->add32(de.getEdgeType());
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
index 5e1bc9968c..53f85907e4 100755
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
@@ -23,7 +23,8 @@
class GrGLDistanceFieldTextureEffect : public GrGLGeometryProcessor {
public:
GrGLDistanceFieldTextureEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor&)
+ const GrGeometryProcessor&,
+ const GrBatchTracker&)
: INHERITED (factory)
, fTextureSize(SkISize::Make(-1,-1))
#ifdef SK_GAMMA_APPLY_TO_A8
@@ -124,10 +125,11 @@ public:
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrProcessor& effect) SK_OVERRIDE {
+ const GrGeometryProcessor& proc,
+ const GrBatchTracker&) SK_OVERRIDE {
SkASSERT(fTextureSizeUni.isValid());
- GrTexture* texture = effect.texture(0);
+ GrTexture* texture = proc.texture(0);
if (texture->width() != fTextureSize.width() ||
texture->height() != fTextureSize.height()) {
fTextureSize = SkISize::Make(texture->width(), texture->height());
@@ -137,7 +139,7 @@ public:
}
#ifdef SK_GAMMA_APPLY_TO_A8
const GrDistanceFieldTextureEffect& dfTexEffect =
- effect.cast<GrDistanceFieldTextureEffect>();
+ proc.cast<GrDistanceFieldTextureEffect>();
float luminance = dfTexEffect.getLuminance();
if (luminance != fLuminance) {
pdman.set1f(fLuminanceUni, luminance);
@@ -146,7 +148,9 @@ public:
#endif
}
- static inline void GenKey(const GrProcessor& processor, const GrGLCaps&,
+ static inline void GenKey(const GrGeometryProcessor& processor,
+ const GrBatchTracker&,
+ const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const GrDistanceFieldTextureEffect& dfTexEffect =
processor.cast<GrDistanceFieldTextureEffect>();
@@ -255,7 +259,8 @@ GrGeometryProcessor* GrDistanceFieldTextureEffect::TestCreate(SkRandom* random,
class GrGLDistanceFieldNoGammaTextureEffect : public GrGLGeometryProcessor {
public:
GrGLDistanceFieldNoGammaTextureEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor& effect)
+ const GrGeometryProcessor&,
+ const GrBatchTracker&)
: INHERITED(factory)
, fTextureSize(SkISize::Make(-1, -1)) {}
@@ -338,10 +343,11 @@ public:
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrProcessor& effect) SK_OVERRIDE {
+ const GrGeometryProcessor& proc,
+ const GrBatchTracker&) SK_OVERRIDE {
SkASSERT(fTextureSizeUni.isValid());
- GrTexture* texture = effect.texture(0);
+ GrTexture* texture = proc.texture(0);
if (texture->width() != fTextureSize.width() ||
texture->height() != fTextureSize.height()) {
fTextureSize = SkISize::Make(texture->width(), texture->height());
@@ -351,10 +357,12 @@ public:
}
}
- static inline void GenKey(const GrProcessor& effect, const GrGLCaps&,
+ static inline void GenKey(const GrGeometryProcessor& proc,
+ const GrBatchTracker&,
+ const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const GrDistanceFieldNoGammaTextureEffect& dfTexEffect =
- effect.cast<GrDistanceFieldNoGammaTextureEffect>();
+ proc.cast<GrDistanceFieldNoGammaTextureEffect>();
b->add32(dfTexEffect.getFlags());
}
@@ -430,7 +438,8 @@ GrGeometryProcessor* GrDistanceFieldNoGammaTextureEffect::TestCreate(SkRandom* r
class GrGLDistanceFieldLCDTextureEffect : public GrGLGeometryProcessor {
public:
GrGLDistanceFieldLCDTextureEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor&)
+ const GrGeometryProcessor&,
+ const GrBatchTracker&)
: INHERITED (factory)
, fTextureSize(SkISize::Make(-1,-1))
, fTextColor(GrColor_ILLEGAL) {}
@@ -563,7 +572,8 @@ public:
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrProcessor& processor) SK_OVERRIDE {
+ const GrGeometryProcessor& processor,
+ const GrBatchTracker&) SK_OVERRIDE {
SkASSERT(fTextureSizeUni.isValid());
SkASSERT(fTextColorUni.isValid());
@@ -594,7 +604,9 @@ public:
}
}
- static inline void GenKey(const GrProcessor& processor, const GrGLCaps&,
+ static inline void GenKey(const GrGeometryProcessor& processor,
+ const GrBatchTracker&,
+ const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const GrDistanceFieldLCDTextureEffect& dfTexEffect =
processor.cast<GrDistanceFieldLCDTextureEffect>();