Remove tab parameter from GrGLSLMulVarBy4f function
With pretty printing of shader code, there is no longer a need to explictily have tabs in our code. BUG=skia: Review URL: https://codereview.chromium.org/648463002
This commit is contained in:
parent
1e2530babb
commit
089f8de82d
@ -1454,7 +1454,7 @@ void GrGLLightingEffect::emitCode(GrGLProgramBuilder* builder,
|
||||
fLight->emitLightColor(builder, "surfaceToLight");
|
||||
fsBuilder->codeAppend(");\n");
|
||||
SkString modulate;
|
||||
GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor);
|
||||
GrGLSLMulVarBy4f(&modulate, outputColor, inputColor);
|
||||
fsBuilder->codeAppend(modulate.c_str());
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ void GrGLMagnifierEffect::emitCode(GrGLProgramBuilder* builder,
|
||||
|
||||
fsBuilder->codeAppendf("\t\t%s = output_color;", outputColor);
|
||||
SkString modulate;
|
||||
GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor);
|
||||
GrGLSLMulVarBy4f(&modulate, outputColor, inputColor);
|
||||
fsBuilder->codeAppend(modulate.c_str());
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ void GrGLMorphologyEffect::emitCode(GrGLProgramBuilder* builder,
|
||||
fsBuilder->codeAppendf("\t\t\tcoord += %s;\n", imgInc);
|
||||
fsBuilder->codeAppend("\t\t}\n");
|
||||
SkString modulate;
|
||||
GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor);
|
||||
GrGLSLMulVarBy4f(&modulate, outputColor, inputColor);
|
||||
fsBuilder->codeAppend(modulate.c_str());
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
fsBuilder->codeAppendf("%s = %s;", outputColor, tmpVar.c_str());
|
||||
}
|
||||
SkString modulate;
|
||||
GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor);
|
||||
GrGLSLMulVarBy4f(&modulate, outputColor, inputColor);
|
||||
fsBuilder->codeAppend(modulate.c_str());
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ void GrGLConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
|
||||
}
|
||||
|
||||
SkString modulate;
|
||||
GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor);
|
||||
GrGLSLMulVarBy4f(&modulate, outputColor, inputColor);
|
||||
fsBuilder->codeAppend(modulate.c_str());
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ void GrGLMatrixConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
|
||||
}
|
||||
|
||||
SkString modulate;
|
||||
GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor);
|
||||
GrGLSLMulVarBy4f(&modulate, outputColor, inputColor);
|
||||
fsBuilder->codeAppend(modulate.c_str());
|
||||
}
|
||||
|
||||
|
@ -69,30 +69,14 @@ const char* GrGetGLSLVersionDecl(const GrGLContextInfo& info) {
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
void append_tabs(SkString* outAppend, int tabCnt) {
|
||||
static const char kTabs[] = "\t\t\t\t\t\t\t\t";
|
||||
while (tabCnt) {
|
||||
int cnt = SkTMin((int)SK_ARRAY_COUNT(kTabs), tabCnt);
|
||||
outAppend->append(kTabs, cnt);
|
||||
tabCnt -= cnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GrGLSLMulVarBy4f(SkString* outAppend,
|
||||
unsigned tabCnt,
|
||||
const char* vec4VarName,
|
||||
const GrGLSLExpr4& mulFactor) {
|
||||
void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSLExpr4& mulFactor) {
|
||||
if (mulFactor.isOnes()) {
|
||||
*outAppend = SkString();
|
||||
}
|
||||
|
||||
append_tabs(outAppend, tabCnt);
|
||||
|
||||
if (mulFactor.isZeros()) {
|
||||
outAppend->appendf("%s = vec4(0);\n", vec4VarName);
|
||||
outAppend->appendf("%s = vec4(0);", vec4VarName);
|
||||
} else {
|
||||
outAppend->appendf("%s *= %s;\n", vec4VarName, mulFactor.c_str());
|
||||
outAppend->appendf("%s *= %s;", vec4VarName, mulFactor.c_str());
|
||||
}
|
||||
}
|
||||
|
@ -310,10 +310,9 @@ private:
|
||||
|
||||
/**
|
||||
* Does an inplace mul, *=, of vec4VarName by mulFactor.
|
||||
* A semicolon and newline are added after the assignment.
|
||||
* A semicolon is added after the assignment.
|
||||
*/
|
||||
void GrGLSLMulVarBy4f(SkString* outAppend, unsigned tabCnt,
|
||||
const char* vec4VarName, const GrGLSLExpr4& mulFactor);
|
||||
void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSLExpr4& mulFactor);
|
||||
|
||||
#include "GrGLSL_impl.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user