aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2014-09-16 06:46:30 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-16 06:46:30 -0700
commit8ddbe8b9366c8c59c4fb55f01f253de8a0b37d6e (patch)
tree737dce511f4f0314e313c825a7db8a38b3544a94 /include/gpu
parentee6206572b42fec11f83ad0c1e6d435903640518 (diff)
removing GrDrawEffect
BUG=skia: R=bsalomon@google.com Author: joshualitt@chromium.org Review URL: https://codereview.chromium.org/571163002
Diffstat (limited to 'include/gpu')
-rw-r--r--include/gpu/GrBackendEffectFactory.h6
-rw-r--r--include/gpu/GrDrawEffect.h47
-rw-r--r--include/gpu/GrEffect.h12
-rw-r--r--include/gpu/GrTBackendEffectFactory.h11
4 files changed, 13 insertions, 63 deletions
diff --git a/include/gpu/GrBackendEffectFactory.h b/include/gpu/GrBackendEffectFactory.h
index e6362520fc..936d632a7e 100644
--- a/include/gpu/GrBackendEffectFactory.h
+++ b/include/gpu/GrBackendEffectFactory.h
@@ -16,7 +16,7 @@
class GrGLEffect;
class GrGLCaps;
-class GrDrawEffect;
+class GrEffect;
/**
* Used by effects to build their keys. It incorporates each per-effect key into a larger shader key.
@@ -96,13 +96,13 @@ public:
* configuration that affect GLSL code generation. Two GrEffect instances that would cause
* this->createGLInstance()->emitCode() to produce different code must produce different keys.
*/
- virtual void getGLEffectKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*) const = 0;
+ virtual void getGLEffectKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*) const = 0;
/**
* Creates a GrGLEffect instance that is used both to generate code for the GrEffect in a GLSL
* program and to manage updating uniforms for the program when it is used.
*/
- virtual GrGLEffect* createGLInstance(const GrDrawEffect&) const = 0;
+ virtual GrGLEffect* createGLInstance(const GrEffect&) const = 0;
/**
* Produces a human-reable name for the effect.
diff --git a/include/gpu/GrDrawEffect.h b/include/gpu/GrDrawEffect.h
deleted file mode 100644
index 710b00035f..0000000000
--- a/include/gpu/GrDrawEffect.h
+++ /dev/null
@@ -1,47 +0,0 @@
-
-#ifndef GrDrawEffect_DEFINED
-#define GrDrawEffect_DEFINED
-
-#include "GrEffectStage.h"
-
-/**
- * This class is used to communicate the particular GrEffect used in a draw to the backend-specific
- * effect subclass (e.g. GrGLEffect). It is used to by the backend-specific class to generate a
- * cache key for the effect, generate code on a program cache miss, and to upload uniform values to
- * the program.
- * In addition to the effect, it also communicates any changes between the relationship between
- * the view matrix and local coordinate system since the effect was installed in its GrDrawState.
- * The typical use case is that sometime after an effect was installed a decision was made to draw
- * in device coordinates (i.e. use an identity view-matrix). In such a case the GrDrawEffect's
- * coord-change-matrix would be the inverse of the view matrix that was set when the effect was
- * installed.
- */
-class GrDrawEffect {
-public:
- GrDrawEffect(const GrEffectStage& stage, bool explicitLocalCoords)
- : fEffectStage(&stage)
- , fExplicitLocalCoords(explicitLocalCoords) {
- SkASSERT(fEffectStage);
- SkASSERT(fEffectStage->getEffect());
- }
- const GrEffect* effect() const { return fEffectStage->getEffect(); }
-
- template <typename T>
- const T& castEffect() const { return *static_cast<const T*>(this->effect()); }
-
- const SkMatrix& getCoordChangeMatrix() const {
- if (fExplicitLocalCoords) {
- return SkMatrix::I();
- } else {
- return fEffectStage->getCoordChangeMatrix();
- }
- }
-
- bool programHasExplicitLocalCoords() const { return fExplicitLocalCoords; }
-
-private:
- const GrEffectStage* fEffectStage;
- bool fExplicitLocalCoords;
-};
-
-#endif
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index 102b9d4b96..e9259979f0 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -130,6 +130,11 @@ public:
::operator delete(target, placement);
}
+ /**
+ * Helper for down-casting to a GrEffect subclass
+ */
+ template <typename T> const T& cast() const { return *static_cast<const T*>(this); }
+
protected:
/**
* Subclasses call this from their constructor to register coordinate transformations. The
@@ -155,13 +160,6 @@ protected:
, fRequiresVertexShader(false) {}
/**
- * Helper for down-casting to a GrEffect subclass
- */
- template <typename T> static const T& CastEffect(const GrEffect& effect) {
- return *static_cast<const T*>(&effect);
- }
-
- /**
* If the effect subclass will read the destination pixel value then it must call this function
* from its constructor. Otherwise, when its generated backend-specific effect class attempts
* to generate code that reads the destination pixel it will fail.
diff --git a/include/gpu/GrTBackendEffectFactory.h b/include/gpu/GrTBackendEffectFactory.h
index 450eb68ee5..a45aeacb72 100644
--- a/include/gpu/GrTBackendEffectFactory.h
+++ b/include/gpu/GrTBackendEffectFactory.h
@@ -9,7 +9,6 @@
#define GrTBackendEffectFactory_DEFINED
#include "GrBackendEffectFactory.h"
-#include "GrDrawEffect.h"
#include "gl/GrGLProgramEffects.h"
/**
@@ -27,7 +26,7 @@
* 1. The GrGLEffect used by GrEffect subclass MyEffect must be named or typedef'ed to
* MyEffect::GLEffect.
* 2. MyEffect::GLEffect must have a static function:
- * EffectKey GenKey(const GrDrawEffect, const GrGLCaps&)
+ * EffectKey GenKey(const GrEffect, const GrGLCaps&)
* which generates a key that maps 1 to 1 with code variations emitted by
* MyEffect::GLEffect::emitCode().
* 3. MyEffect must have a static function:
@@ -46,17 +45,17 @@ public:
/** Implemented using GLEffect::GenKey as described in this class's comment. */
- virtual void getGLEffectKey(const GrDrawEffect& drawEffect,
+ virtual void getGLEffectKey(const GrEffect& effect,
const GrGLCaps& caps,
GrEffectKeyBuilder* b) const SK_OVERRIDE {
- GLEffect::GenKey(drawEffect, caps, b);
+ GLEffect::GenKey(effect, caps, b);
}
/** Returns a new instance of the appropriate *GL* implementation class
for the given GrEffect; caller is responsible for deleting
the object. */
- virtual GrGLEffect* createGLInstance(const GrDrawEffect& drawEffect) const SK_OVERRIDE {
- return SkNEW_ARGS(GLEffect, (*this, drawEffect));
+ virtual GrGLEffect* createGLInstance(const GrEffect& effect) const SK_OVERRIDE {
+ return SkNEW_ARGS(GLEffect, (*this, effect));
}
/** This class is a singleton. This function returns the single instance. */