diff options
author | 2012-07-25 17:48:39 +0000 | |
---|---|---|
committer | 2012-07-25 17:48:39 +0000 | |
commit | dbbc4e2da93cef5c0cfb0b3c92ff6c2c80f6e67a (patch) | |
tree | 47f0ffe4944a83ac239b8e349bcd9b2479ce85da /src/gpu/effects/GrMorphologyEffect.cpp | |
parent | b10a6bd0a7df0ceeea0d53585c049450ec58b4b9 (diff) |
Add GL uniform manager
Review URL: http://codereview.appspot.com/6423066/
git-svn-id: http://skia.googlecode.com/svn/trunk@4758 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects/GrMorphologyEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrMorphologyEffect.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/gpu/effects/GrMorphologyEffect.cpp b/src/gpu/effects/GrMorphologyEffect.cpp index 6699989f04..22c986ab68 100644 --- a/src/gpu/effects/GrMorphologyEffect.cpp +++ b/src/gpu/effects/GrMorphologyEffect.cpp @@ -29,10 +29,7 @@ public: static inline StageKey GenKey(const GrCustomStage& s); - virtual void initUniforms(const GrGLShaderBuilder*, - const GrGLInterface*, - int programID) SK_OVERRIDE; - virtual void setData(const GrGLInterface*, + virtual void setData(const GrGLUniformManager&, const GrCustomStage&, const GrRenderTarget*, int stageNum) SK_OVERRIDE; @@ -40,10 +37,9 @@ public: private: int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); } - int fRadius; - GrMorphologyEffect::MorphologyType fType; - GrGLShaderBuilder::UniformHandle fImageIncrementUni; - GrGLint fImageIncrementLocation; + int fRadius; + GrMorphologyEffect::MorphologyType fType; + GrGLUniformManager::UniformHandle fImageIncrementUni; typedef GrGLProgramStage INHERITED; }; @@ -51,8 +47,7 @@ private: GrGLMorphologyEffect ::GrGLMorphologyEffect(const GrProgramStageFactory& factory, const GrCustomStage& stage) : GrGLProgramStage(factory) - , fImageIncrementUni(GrGLShaderBuilder::kInvalidUniformHandle) - , fImageIncrementLocation(0) { + , fImageIncrementUni(GrGLUniformManager::kInvalidUniformHandle) { const GrMorphologyEffect& m = static_cast<const GrMorphologyEffect&>(stage); fRadius = m.radius(); fType = m.type(); @@ -71,13 +66,6 @@ void GrGLMorphologyEffect::emitVS(GrGLShaderBuilder* builder, code->appendf("\t\t%s -= vec2(%d, %d) * %s;\n", vertexCoords, fRadius, fRadius, imgInc); } -void GrGLMorphologyEffect::initUniforms(const GrGLShaderBuilder* builder, - const GrGLInterface* gl, - int programID) { - const char* imgInc = builder->getUniformCStr(fImageIncrementUni); - GR_GL_CALL_RET(gl, fImageIncrementLocation, GetUniformLocation(programID, imgInc)); -} - void GrGLMorphologyEffect ::emitFS(GrGLShaderBuilder* builder, const char* outputColor, const char* inputColor, @@ -119,7 +107,7 @@ GrGLProgramStage::StageKey GrGLMorphologyEffect::GenKey( return key; } -void GrGLMorphologyEffect ::setData(const GrGLInterface* gl, +void GrGLMorphologyEffect ::setData(const GrGLUniformManager& uman, const GrCustomStage& data, const GrRenderTarget*, int stageNum) { @@ -140,7 +128,7 @@ void GrGLMorphologyEffect ::setData(const GrGLInterface* gl, default: GrCrash("Unknown filter direction."); } - GR_GL_CALL(gl, Uniform2fv(fImageIncrementLocation, 1, imageIncrement)); + uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement); } /////////////////////////////////////////////////////////////////////////////// |