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
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 652c6bc..b6a69f2 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -58,7 +58,7 @@
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 4c42987..6930bec 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -29,7 +29,7 @@
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 @@
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 0ba748c..844bff7 100644
--- a/src/gpu/effects/GrSingleTextureEffect.cpp
+++ b/src/gpu/effects/GrSingleTextureEffect.cpp
@@ -29,7 +29,7 @@
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 bfbab29..1c2ad33 100644
--- a/src/gpu/effects/GrTextureDomainEffect.cpp
+++ b/src/gpu/effects/GrTextureDomainEffect.cpp
@@ -23,7 +23,7 @@
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 3f8417c..b53a1cf 100644
--- a/src/gpu/gl/GrGLEffect.cpp
+++ b/src/gpu/gl/GrGLEffect.cpp
@@ -20,12 +20,12 @@
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 404f275..132c3d7 100644
--- a/src/gpu/gl/GrGLEffect.h
+++ b/src/gpu/gl/GrGLEffect.h
@@ -23,7 +23,7 @@
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 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 @@
@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 @@
*/
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 @@
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 @@
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 cbcd2d5..fd01e0d 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -80,7 +80,7 @@
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 @@
}
for (int i = 0; i < GrDrawState::kNumStages; ++i) {
- delete fProgramStage[i];
+ delete fEffects[i];
}
}
@@ -624,13 +624,13 @@
}
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 @@
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 @@
builder->fFSCode.appendf("\t{ // %s \n", glStage->name());
glStage->emitCode(builder,
*effect,
- desc.fCustomStageKey,
+ desc.fEffectKey,
varyingVSName,
fsOutColor,
fsInColor,
@@ -975,10 +975,10 @@
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 57c6d22..8adcd62 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -96,9 +96,8 @@
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 @@
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 a915cfa..e736231 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -153,9 +153,9 @@
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 d60f33f..fa68268 100644
--- a/src/gpu/gl/GrGLShaderBuilder.h
+++ b/src/gpu/gl/GrGLShaderBuilder.h
@@ -119,11 +119,11 @@
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 dfb1123..d0b7b57 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -573,10 +573,10 @@
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 @@
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;
}
}