aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrSingleTextureEffect.cpp
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-19 18:01:07 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-19 18:01:07 +0000
commitaa72eab5d82d4c2aa9f6f41755a001282443b042 (patch)
tree3d9bd22faeda1b5973683bba39033b4e26c63ffd /src/gpu/effects/GrSingleTextureEffect.cpp
parent3af4ff46a7461f78c8ab24d1e8213b187e8472e2 (diff)
Create GL implementation for GrSingleTextureEffect, use it instead of GrPaint::setTexture()
or GrDrawState::setTexture() in GrContext.cpp http://codereview.appspot.com/6399053/ git-svn-id: http://skia.googlecode.com/svn/trunk@4677 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects/GrSingleTextureEffect.cpp')
-rw-r--r--src/gpu/effects/GrSingleTextureEffect.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp
index a373ebe4e1..d8b90a15fc 100644
--- a/src/gpu/effects/GrSingleTextureEffect.cpp
+++ b/src/gpu/effects/GrSingleTextureEffect.cpp
@@ -6,8 +6,39 @@
*/
#include "effects/GrSingleTextureEffect.h"
+#include "gl/GrGLProgramStage.h"
+#include "gl/GrGLSL.h"
+#include "gl/GrGLTexture.h"
+#include "GrProgramStageFactory.h"
#include "GrTexture.h"
+// For brevity, and these definitions are likely to move to a different class soon.
+typedef GrGLShaderBuilder::UniformHandle UniformHandle;
+static const UniformHandle kInvalidUniformHandle = GrGLShaderBuilder::kInvalidUniformHandle;
+
+class GrGLSingleTextureEffect : public GrGLProgramStage {
+public:
+ GrGLSingleTextureEffect(const GrProgramStageFactory& factory,
+ const GrCustomStage& stage) : INHERITED (factory) { }
+
+ virtual void emitVS(GrGLShaderBuilder* builder,
+ const char* vertexCoords) SK_OVERRIDE { }
+ virtual void emitFS(GrGLShaderBuilder* builder,
+ const char* outputColor,
+ const char* inputColor,
+ const char* samplerName) SK_OVERRIDE {
+ builder->emitDefaultFetch(outputColor, samplerName);
+ }
+
+ static inline StageKey GenKey(const GrCustomStage&) { return 0; }
+
+private:
+
+ typedef GrGLProgramStage INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture)
: fTexture (texture) {
SkSafeRef(fTexture);
@@ -26,4 +57,8 @@ GrTexture* GrSingleTextureEffect::texture(unsigned int index) const {
return fTexture;
}
+const GrProgramStageFactory& GrSingleTextureEffect::getFactory() const {
+ return GrTProgramStageFactory<GrSingleTextureEffect>::getInstance();
+}
+