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

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

Issue 1709153002: Add more specialized fragment builders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make MSVC happy Created 4 years, 10 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
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.cpp ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 kVec2f_GrSLType, kDefault_GrSLPr ecision, 43 kVec2f_GrSLType, kDefault_GrSLPr ecision,
44 "Bounds"); 44 "Bounds");
45 } 45 }
46 46
47 int width = Gr1DKernelEffect::WidthFromRadius(ce.radius()); 47 int width = Gr1DKernelEffect::WidthFromRadius(ce.radius());
48 48
49 fKernelUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag, 49 fKernelUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag,
50 kFloat_GrSLType, kDefault_GrSLP recision, 50 kFloat_GrSLType, kDefault_GrSLP recision,
51 "Kernel", width); 51 "Kernel", width);
52 52
53 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 53 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
54 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); 54 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
55 55
56 fragBuilder->codeAppendf("%s = vec4(0, 0, 0, 0);", args.fOutputColor); 56 fragBuilder->codeAppendf("%s = vec4(0, 0, 0, 0);", args.fOutputColor);
57 57
58 const GrGLSLShaderVar& kernel = uniformHandler->getUniformVariable(fKernelUn i); 58 const GrGLSLShaderVar& kernel = uniformHandler->getUniformVariable(fKernelUn i);
59 const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni); 59 const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni);
60 60
61 fragBuilder->codeAppendf("vec2 coord = %s - %d.0 * %s;", coords2D.c_str(), c e.radius(), imgInc); 61 fragBuilder->codeAppendf("vec2 coord = %s - %d.0 * %s;", coords2D.c_str(), c e.radius(), imgInc);
62 62
63 // Manually unroll loop because some drivers don't; yields 20-30% speedup. 63 // Manually unroll loop because some drivers don't; yields 20-30% speedup.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 bool useBounds = d->fRandom->nextBool(); 223 bool useBounds = d->fRandom->nextBool();
224 return GrConvolutionEffect::Create(d->fTextures[texIdx], 224 return GrConvolutionEffect::Create(d->fTextures[texIdx],
225 dir, 225 dir,
226 radius, 226 radius,
227 kernel, 227 kernel,
228 useBounds, 228 useBounds,
229 bounds); 229 bounds);
230 } 230 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.cpp ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698