aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-12 17:23:52 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-12 17:23:52 +0000
commitd0c1a06cb98dd4a009dfa79e37ba6ca23a8c180b (patch)
tree8da05f518d09f633dfd00f94b45593182089deac /include
parentd7727ceb82e271f8b5580c51571c57b09c5e3ced (diff)
Introduces new SingleTextureEffect base class for GrCustomStage objects.
This class tracks the texture that the object uses. A future commit will get rid of the GrTexture pointer currenty stored in the GrDrawState, allowing us to have CustomStages *without* textures. Requires gyp change on next roll. http://codereview.appspot.com/6306097/ git-svn-id: http://skia.googlecode.com/svn/trunk@4576 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkImageFilter.h3
-rw-r--r--include/gpu/GrCustomStage.h19
2 files changed, 18 insertions, 4 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index b7bf8bcfef..0915b90714 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -15,6 +15,7 @@ class SkDevice;
class SkMatrix;
struct SkPoint;
class GrCustomStage;
+class GrTexture;
/**
* Experimental.
@@ -86,7 +87,7 @@ public:
* in it. The caller assumes ownership of the stage, and it is up to the
* caller to unref it.
*/
- virtual bool asNewCustomStage(GrCustomStage** stage) const;
+ virtual bool asNewCustomStage(GrCustomStage** stage, GrTexture*) const;
/**
* Experimental.
diff --git a/include/gpu/GrCustomStage.h b/include/gpu/GrCustomStage.h
index fd01c9a767..9f5efd33fb 100644
--- a/include/gpu/GrCustomStage.h
+++ b/include/gpu/GrCustomStage.h
@@ -13,11 +13,17 @@
#include "GrProgramStageFactory.h"
class GrContext;
+class GrTexture;
/** Provides custom vertex shader, fragment shader, uniform data for a
particular stage of the Ganesh shading pipeline.
Subclasses must have a function that produces a human-readable name:
static const char* Name();
+ GrCustomStage objects *must* be immutable: after being constructed,
+ their fields may not change. (Immutability isn't actually required
+ until they've been used in a draw call, but supporting that would require
+ setters and getters that could fail, copy-on-write, or deep copying of these
+ objects when they're stored by a GrGLProgramStage.)
*/
class GrCustomStage : public GrRefCnt {
@@ -60,15 +66,22 @@ public:
To test for equivalence (that they will generate the same
shader code, but may have different uniforms), check equality
of the stageKey produced by the GrProgramStageFactory:
- a.getFactory().glStageKey(a) == b.getFactory().glStageKey(b). */
- virtual bool isEqual(const GrCustomStage&) const = 0;
+ a.getFactory().glStageKey(a) == b.getFactory().glStageKey(b).
+
+ The default implementation of this function returns true iff
+ the two stages have the same return value for numTextures() and
+ for texture() over all valid indicse.
+ */
+ virtual bool isEqual(const GrCustomStage&) const;
/** Human-meaningful string to identify this effect; may be embedded
in generated shader code. */
const char* name() const { return this->getFactory().name(); }
-private:
+ virtual unsigned int numTextures() const;
+ virtual GrTexture* texture(unsigned int index) const;
+private:
typedef GrRefCnt INHERITED;
};