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

Side by Side Diff: src/gpu/effects/GrConvolutionEffect.cpp

Issue 2324663004: Remove unneeded GrGLSLTransformedCoordsArray type (Closed)
Patch Set: update comments Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrConvolutionEffect.h" 8 #include "GrConvolutionEffect.h"
9 #include "glsl/GrGLSLFragmentProcessor.h" 9 #include "glsl/GrGLSLFragmentProcessor.h"
10 #include "glsl/GrGLSLFragmentShaderBuilder.h" 10 #include "glsl/GrGLSLFragmentShaderBuilder.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 int width = Gr1DKernelEffect::WidthFromRadius(ce.radius()); 47 int width = Gr1DKernelEffect::WidthFromRadius(ce.radius());
48 48
49 int arrayCount = (width + 3) / 4; 49 int arrayCount = (width + 3) / 4;
50 SkASSERT(4 * arrayCount >= width); 50 SkASSERT(4 * arrayCount >= width);
51 51
52 fKernelUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag, 52 fKernelUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag,
53 kVec4f_GrSLType, kDefault_GrSLP recision, 53 kVec4f_GrSLType, kDefault_GrSLP recision,
54 "Kernel", arrayCount); 54 "Kernel", arrayCount);
55 55
56 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; 56 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
57 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); 57 SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
58 58
59 fragBuilder->codeAppendf("%s = vec4(0, 0, 0, 0);", args.fOutputColor); 59 fragBuilder->codeAppendf("%s = vec4(0, 0, 0, 0);", args.fOutputColor);
60 60
61 const GrGLSLShaderVar& kernel = uniformHandler->getUniformVariable(fKernelUn i); 61 const GrGLSLShaderVar& kernel = uniformHandler->getUniformVariable(fKernelUn i);
62 const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni); 62 const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni);
63 63
64 fragBuilder->codeAppendf("vec2 coord = %s - %d.0 * %s;", coords2D.c_str(), c e.radius(), imgInc); 64 fragBuilder->codeAppendf("vec2 coord = %s - %d.0 * %s;", coords2D.c_str(), c e.radius(), imgInc);
65 65
66 // Manually unroll loop because some drivers don't; yields 20-30% speedup. 66 // Manually unroll loop because some drivers don't; yields 20-30% speedup.
67 const char* kVecSuffix[4] = { ".x", ".y", ".z", ".w" }; 67 const char* kVecSuffix[4] = { ".x", ".y", ".z", ".w" };
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 229
230 bool useBounds = d->fRandom->nextBool(); 230 bool useBounds = d->fRandom->nextBool();
231 return GrConvolutionEffect::Make(d->fTextures[texIdx], 231 return GrConvolutionEffect::Make(d->fTextures[texIdx],
232 dir, 232 dir,
233 radius, 233 radius,
234 kernel, 234 kernel,
235 useBounds, 235 useBounds,
236 bounds); 236 bounds);
237 } 237 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConfigConversionEffect.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698