Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 356513003: Step towards variable length effect keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak comment Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLShaderBuilder.cpp
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index 4b7de027936df1debe1adc44f1b74fc6c24a26d1..7a57d8e32e609e3909a436b92bafb5755aaf239f 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -194,15 +194,19 @@ bool GrGLShaderBuilder::genProgram(const GrEffectStage* colorStages[],
///////////////////////////////////////////////////////////////////////////
// emit the per-effect code for both color and coverage effects
+ GrGLProgramDesc::EffectKeyProvider colorKeyProvider(
+ &this->desc(), GrGLProgramDesc::EffectKeyProvider::kColor_EffectType);
fOutput.fColorEffects.reset(this->createAndEmitEffects(colorStages,
- this->desc().getEffectKeys(),
this->desc().numColorEffects(),
+ colorKeyProvider,
&inputColor));
+ GrGLProgramDesc::EffectKeyProvider coverageKeyProvider(
+ &this->desc(), GrGLProgramDesc::EffectKeyProvider::kCoverage_EffectType);
fOutput.fCoverageEffects.reset(this->createAndEmitEffects(coverageStages,
- this->desc().getEffectKeys() + this->desc().numColorEffects(),
- this->desc().numCoverageEffects(),
- &inputCoverage));
+ this->desc().numCoverageEffects(),
+ coverageKeyProvider,
+ &inputCoverage));
this->emitCodeAfterEffects();
@@ -601,8 +605,8 @@ void GrGLShaderBuilder::appendUniformDecls(ShaderVisibility visibility,
void GrGLShaderBuilder::createAndEmitEffects(GrGLProgramEffectsBuilder* programEffectsBuilder,
const GrEffectStage* effectStages[],
- const EffectKey effectKeys[],
int effectCnt,
+ const GrGLProgramDesc::EffectKeyProvider& keyProvider,
GrGLSLExpr4* fsInOutColor) {
bool effectEmitted = false;
@@ -632,7 +636,7 @@ void GrGLShaderBuilder::createAndEmitEffects(GrGLProgramEffectsBuilder* programE
programEffectsBuilder->emitEffect(stage,
- effectKeys[e],
+ keyProvider.get(e),
outColor.c_str(),
inColor.isOnes() ? NULL : inColor.c_str(),
fCodeStage.stageIndex());
@@ -976,15 +980,15 @@ const SkString* GrGLFullShaderBuilder::getEffectAttributeName(int attributeIndex
GrGLProgramEffects* GrGLFullShaderBuilder::createAndEmitEffects(
const GrEffectStage* effectStages[],
- const EffectKey effectKeys[],
int effectCnt,
+ const GrGLProgramDesc::EffectKeyProvider& keyProvider,
GrGLSLExpr4* inOutFSColor) {
GrGLVertexProgramEffectsBuilder programEffectsBuilder(this, effectCnt);
this->INHERITED::createAndEmitEffects(&programEffectsBuilder,
effectStages,
- effectKeys,
effectCnt,
+ keyProvider,
inOutFSColor);
return programEffectsBuilder.finish();
}
@@ -1093,16 +1097,16 @@ int GrGLFragmentOnlyShaderBuilder::addTexCoordSets(int count) {
GrGLProgramEffects* GrGLFragmentOnlyShaderBuilder::createAndEmitEffects(
const GrEffectStage* effectStages[],
- const EffectKey effectKeys[],
int effectCnt,
+ const GrGLProgramDesc::EffectKeyProvider& keyProvider,
GrGLSLExpr4* inOutFSColor) {
GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this,
effectCnt);
this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder,
effectStages,
- effectKeys,
effectCnt,
+ keyProvider,
inOutFSColor);
return pathTexGenEffectsBuilder.finish();
}

Powered by Google App Engine
This is Rietveld 408576698