diff options
author | 2012-10-25 21:42:05 +0000 | |
---|---|---|
committer | 2012-10-25 21:42:05 +0000 | |
commit | 46fba0d79335f17429bb71d87a04d93fb2ee992b (patch) | |
tree | ba0a11312408578eeea662a47f249a6248081e74 /src/gpu | |
parent | 0e363109199198e21237fa4e8314094917e62640 (diff) |
Rename StageKey and related stuff.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6785049
git-svn-id: http://skia.googlecode.com/svn/trunk@6130 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/effects/GrConfigConversionEffect.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrConvolutionEffect.cpp | 4 | ||||
-rw-r--r-- | src/gpu/effects/GrSingleTextureEffect.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureDomainEffect.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLEffect.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/GrGLEffect.h | 16 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgram.cpp | 38 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgram.h | 7 | ||||
-rw-r--r-- | src/gpu/gl/GrGLShaderBuilder.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/GrGLShaderBuilder.h | 6 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL_program.cpp | 8 |
11 files changed, 48 insertions, 49 deletions
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 652c6bc292..b6a69f21b5 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -58,7 +58,7 @@ public: GrGLSLMulVarBy4f(&builder->fFSCode, 2, outputColor, inputColor); } - static inline StageKey GenKey(const GrEffect& s, const GrGLCaps&) { + static inline EffectKey GenKey(const GrEffect& s, const GrGLCaps&) { const GrConfigConversionEffect& effect = static_cast<const GrConfigConversionEffect&>(s); return static_cast<int>(effect.swapsRedAndBlue()) | (effect.pmConversion() << 1); } diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index 4c42987d93..6930bec34c 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -29,7 +29,7 @@ public: virtual void setData(const GrGLUniformManager& uman, const GrEffect&) SK_OVERRIDE; - static inline StageKey GenKey(const GrEffect&, const GrGLCaps&); + static inline EffectKey GenKey(const GrEffect&, const GrGLCaps&); private: int width() const { return Gr1DKernelEffect::WidthFromRadius(fRadius); } @@ -108,7 +108,7 @@ void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman, const GrEffe uman.set1fv(fKernelUni, 0, this->width(), conv.kernel()); } -GrGLEffect::StageKey GrGLConvolutionEffect::GenKey(const GrEffect& s, +GrGLEffect::EffectKey GrGLConvolutionEffect::GenKey(const GrEffect& s, const GrGLCaps& caps) { return static_cast<const GrConvolutionEffect&>(s).radius(); } diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp index 0ba748c3f0..844bff7693 100644 --- a/src/gpu/effects/GrSingleTextureEffect.cpp +++ b/src/gpu/effects/GrSingleTextureEffect.cpp @@ -29,7 +29,7 @@ public: builder->fFSCode.append(";\n"); } - static inline StageKey GenKey(const GrEffect&, const GrGLCaps&) { return 0; } + static inline EffectKey GenKey(const GrEffect&, const GrGLCaps&) { return 0; } private: diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp index bfbab2995f..1c2ad33cff 100644 --- a/src/gpu/effects/GrTextureDomainEffect.cpp +++ b/src/gpu/effects/GrTextureDomainEffect.cpp @@ -23,7 +23,7 @@ public: virtual void setData(const GrGLUniformManager&, const GrEffect&) SK_OVERRIDE; - static inline StageKey GenKey(const GrEffect&, const GrGLCaps&) { return 0; } + static inline EffectKey GenKey(const GrEffect&, const GrGLCaps&) { return 0; } private: GrGLUniformManager::UniformHandle fNameUni; diff --git a/src/gpu/gl/GrGLEffect.cpp b/src/gpu/gl/GrGLEffect.cpp index 3f8417c448..b53a1cf9bb 100644 --- a/src/gpu/gl/GrGLEffect.cpp +++ b/src/gpu/gl/GrGLEffect.cpp @@ -20,12 +20,12 @@ GrGLEffect::~GrGLEffect() { void GrGLEffect::setData(const GrGLUniformManager&, const GrEffect&) { } -GrGLEffect::StageKey GrGLEffect::GenTextureKey(const GrEffect& effect, +GrGLEffect::EffectKey GrGLEffect::GenTextureKey(const GrEffect& effect, const GrGLCaps& caps) { - StageKey key = 0; + EffectKey key = 0; for (int index = 0; index < effect.numTextures(); ++index) { const GrTextureAccess& access = effect.textureAccess(index); - StageKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) << index; + EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) << index; GrAssert(0 == (value & key)); // keys for each access ought not to overlap key |= value; } diff --git a/src/gpu/gl/GrGLEffect.h b/src/gpu/gl/GrGLEffect.h index 404f275b30..132c3d78de 100644 --- a/src/gpu/gl/GrGLEffect.h +++ b/src/gpu/gl/GrGLEffect.h @@ -23,7 +23,7 @@ class GrGLTexture; include/gpu/GrEffect.h. Objects of type GrGLEffect are responsible for emitting the GLSL code that implements a GrEffect and for uploading uniforms at draw time. They also must have a function: - static inline StageKey GenKey(const GrEffect&, const GrGLCaps&) + static inline EffectKey GenKey(const GrEffect&, const GrGLCaps&) that is used to implement a program cache. When two GrEffects produce the same key this means that their GrGLEffects would emit the same GLSL code. @@ -33,10 +33,10 @@ class GrGLTexture; class GrGLEffect { public: - typedef GrEffect::StageKey StageKey; + typedef GrEffect::EffectKey EffectKey; enum { - // the number of bits in StageKey available to GenKey - kProgramStageKeyBits = GrBackendEffectFactory::kProgramStageKeyBits, + // the number of bits in EffectKey available to GenKey + kEffectKeyBits = GrBackendEffectFactory::kEffectKeyBits, }; typedef GrGLShaderBuilder::TextureSamplerArray TextureSamplerArray; @@ -51,7 +51,7 @@ public: @param builder Interface used to emit code in the shaders. @param effect The effect that generated this program stage. - @param key The key that was computed by StageKey() from the generating GrEffect. + @param key The key that was computed by EffectKey() from the generating GrEffect. @param vertexCoords A vec2 of texture coordinates in the VS, which may be altered. This will be removed soon and stages will be responsible for computing their own coords. @@ -68,7 +68,7 @@ public: */ virtual void emitCode(GrGLShaderBuilder* builder, const GrEffect& effect, - StageKey key, + EffectKey key, const char* vertexCoords, const char* outputColor, const char* inputColor, @@ -81,7 +81,7 @@ public: const char* name() const { return fFactory.name(); } - static StageKey GenTextureKey(const GrEffect&, const GrGLCaps&); + static EffectKey GenTextureKey(const GrEffect&, const GrGLCaps&); protected: @@ -107,7 +107,7 @@ public: virtual void emitCode(GrGLShaderBuilder* builder, const GrEffect&, - StageKey, + EffectKey, const char* vertexCoords, const char* outputColor, const char* inputColor, diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index cbcd2d5057..fd01e0d233 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -80,7 +80,7 @@ GrGLProgram::GrGLProgram(const GrGLContextInfo& gl, fRTHeight = -1; for (int s = 0; s < GrDrawState::kNumStages; ++s) { - fProgramStage[s] = NULL; + fEffects[s] = NULL; fTextureMatrices[s] = GrMatrix::InvalidMatrix(); // this is arbitrary, just initialize to something fTextureOrientation[s] = GrGLTexture::kBottomUp_Orientation; @@ -104,7 +104,7 @@ GrGLProgram::~GrGLProgram() { } for (int i = 0; i < GrDrawState::kNumStages; ++i) { - delete fProgramStage[i]; + delete fEffects[i]; } } @@ -624,13 +624,13 @@ bool GrGLProgram::genProgram(const GrEffect** effects) { } builder.setCurrentStage(s); - fProgramStage[s] = GenStageCode(effects[s], - fDesc.fStages[s], - &fUniforms.fStages[s], - inColor.size() ? inColor.c_str() : NULL, - outColor.c_str(), - inCoords, - &builder); + fEffects[s] = GenStageCode(effects[s], + fDesc.fStages[s], + &fUniforms.fStages[s], + inColor.size() ? inColor.c_str() : NULL, + outColor.c_str(), + inCoords, + &builder); builder.setNonStage(); inColor = outColor; } @@ -729,13 +729,13 @@ bool GrGLProgram::genProgram(const GrEffect** effects) { inCoverage.append("4"); } builder.setCurrentStage(s); - fProgramStage[s] = GenStageCode(effects[s], - fDesc.fStages[s], - &fUniforms.fStages[s], - inCoverage.size() ? inCoverage.c_str() : NULL, - outCoverage.c_str(), - inCoords, - &builder); + fEffects[s] = GenStageCode(effects[s], + fDesc.fStages[s], + &fUniforms.fStages[s], + inCoverage.size() ? inCoverage.c_str() : NULL, + outCoverage.c_str(), + inCoords, + &builder); builder.setNonStage(); inCoverage = outCoverage; } @@ -957,7 +957,7 @@ GrGLEffect* GrGLProgram::GenStageCode(const GrEffect* effect, builder->fFSCode.appendf("\t{ // %s \n", glStage->name()); glStage->emitCode(builder, *effect, - desc.fCustomStageKey, + desc.fEffectKey, varyingVSName, fsOutColor, fsInColor, @@ -975,10 +975,10 @@ void GrGLProgram::setData(const GrDrawState& drawState) { fRTHeight = rtHeight; } for (int s = 0; s < GrDrawState::kNumStages; ++s) { - if (NULL != fProgramStage[s]) { + if (NULL != fEffects[s]) { const GrSamplerState& sampler = drawState.getSampler(s); GrAssert(NULL != sampler.getEffect()); - fProgramStage[s]->setData(fUniformManager, *sampler.getEffect()); + fEffects[s]->setData(fUniformManager, *sampler.getEffect()); } } } diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index 57c6d22a63..8adcd6278d 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -96,9 +96,8 @@ public: uint8_t fOptFlags; - /** Non-zero if user-supplied code will write the stage's - contribution to the fragment shader. */ - GrBackendEffectFactory::StageKey fCustomStageKey; + /** Non-zero if this stage has an effect */ + GrBackendEffectFactory::EffectKey fEffectKey; inline bool isEnabled() const { return SkToBool(fOptFlags & kIsEnabled_OptFlagBit); @@ -254,7 +253,7 @@ private: GrMatrix fTextureMatrices[GrDrawState::kNumStages]; GrGLTexture::Orientation fTextureOrientation[GrDrawState::kNumStages]; - GrGLEffect* fProgramStage[GrDrawState::kNumStages]; + GrGLEffect* fEffects[GrDrawState::kNumStages]; Desc fDesc; const GrGLContextInfo& fContextInfo; diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp index a915cfa1ac..e736231ee9 100644 --- a/src/gpu/gl/GrGLShaderBuilder.cpp +++ b/src/gpu/gl/GrGLShaderBuilder.cpp @@ -153,9 +153,9 @@ void GrGLShaderBuilder::appendTextureLookupAndModulate( GrGLSLModulate4f(out, modulation, lookup.c_str()); } -GrEffect::StageKey GrGLShaderBuilder::KeyForTextureAccess(const GrTextureAccess& access, - const GrGLCaps& caps) { - GrEffect::StageKey key = 0; +GrEffect::EffectKey GrGLShaderBuilder::KeyForTextureAccess(const GrTextureAccess& access, + const GrGLCaps& caps) { + GrEffect::EffectKey key = 0; // Assume that swizzle support implies that we never have to modify a shader to adjust // for texture format/swizzle settings. diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h index d60f33f7a3..fa68268576 100644 --- a/src/gpu/gl/GrGLShaderBuilder.h +++ b/src/gpu/gl/GrGLShaderBuilder.h @@ -119,11 +119,11 @@ public: const char* body, SkString* outName); - /** Generates a StageKey for the shader code based on the texture access parameters and the + /** Generates a EffectKey for the shader code based on the texture access parameters and the capabilities of the GL context. This is useful for keying the shader programs that may have multiple representations, based on the type/format of textures used. */ - static GrEffect::StageKey KeyForTextureAccess(const GrTextureAccess& access, - const GrGLCaps& caps); + static GrEffect::EffectKey KeyForTextureAccess(const GrTextureAccess& access, + const GrGLCaps& caps); /** If texture swizzling is available using tex parameters then it is preferred over mangling the generated shader code. This potentially allows greater reuse of cached shaders. */ diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index dfb1123a3a..d0b7b57b6d 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -573,10 +573,10 @@ void setup_effect(GrGLProgram::Desc::StageDesc* stage, const GrEffect* effect = sampler.getEffect(); if (effect) { const GrBackendEffectFactory& factory = effect->getFactory(); - stage->fCustomStageKey = factory.glStageKey(*effect, caps); + stage->fEffectKey = factory.glEffectKey(*effect, caps); effects[index] = effect; } else { - stage->fCustomStageKey = 0; + stage->fEffectKey = 0; effects[index] = NULL; } } @@ -695,8 +695,8 @@ void GrGpuGL::buildProgram(bool isPoints, setup_effect(&stage, sampler, this->glCaps(), effects, fCurrentProgram.get(), s); } else { - stage.fOptFlags = 0; - stage.fCustomStageKey = 0; + stage.fOptFlags = 0; + stage.fEffectKey = 0; effects[s] = NULL; } } |