diff options
author | 2012-06-13 18:12:57 +0000 | |
---|---|---|
committer | 2012-06-13 18:12:57 +0000 | |
commit | db3a1541f090d5853a62c546b8401a099e7d75ee (patch) | |
tree | a052c8857b63972a22309c7fe7c2a33af19ad5d4 /src/gpu/effects/GrConvolutionEffect.cpp | |
parent | 8ae3c7f67eb3721bb656cffeadc1442332f10159 (diff) |
Remove local variable from GrConvolutionEffect GLSL code; reported to give marginal speedup
on some Intel architectures. Original patch from kondapallykalyan@.
http://codereview.appspot.com/6302070/
git-svn-id: http://skia.googlecode.com/svn/trunk@4250 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects/GrConvolutionEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrConvolutionEffect.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index 5aaa1858a0..d1ccc917ec 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -85,7 +85,7 @@ void GrGLConvolutionEffect::emitFS(GrGLShaderBuilder* state, const char* samplerName) { GrStringBuilder* code = &state->fFSCode; - code->appendf("\t\tvec4 sum = vec4(0, 0, 0, 0);\n"); + code->appendf("\t\t%s = vec4(0, 0, 0, 0);\n", outputColor); code->appendf("\t\tvec2 coord = %s;\n", state->fSampleCoords.c_str()); @@ -95,14 +95,17 @@ void GrGLConvolutionEffect::emitFS(GrGLShaderBuilder* state, GrStringBuilder kernelIndex; index.appendS32(i); fKernelVar->appendArrayAccess(index.c_str(), &kernelIndex); - code->appendf("\t\tsum += "); + code->appendf("\t\t%s += ", outputColor); state->emitTextureLookup(samplerName, "coord"); code->appendf(" * %s;\n", kernelIndex.c_str()); code->appendf("\t\tcoord += %s;\n", fImageIncrementVar->getName().c_str()); } - code->appendf("\t\t%s = sum%s;\n", outputColor, state->fModulate.c_str()); + if (state->fModulate.size()) { + code->appendf("\t\t%s = %s%s;\n", outputColor, outputColor, + state->fModulate.c_str()); + } } void GrGLConvolutionEffect::initUniforms(const GrGLInterface* gl, |