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

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

Issue 1417123002: Move GrGLShaderVar to GrGLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix gyp Created 5 years, 2 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/GrBezierEffect.cpp ('k') | src/gpu/effects/GrConfigConversionEffect.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 2014 Google Inc. 2 * Copyright 2014 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 "GrBicubicEffect.h" 8 #include "GrBicubicEffect.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "gl/builders/GrGLProgramBuilder.h" 10 #include "gl/builders/GrGLProgramBuilder.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 "Coefficients"); 55 "Coefficients");
56 fImageIncrementUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment _Visibility, 56 fImageIncrementUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment _Visibility,
57 kVec2f_GrSLType, kDefault_GrSLPreci sion, 57 kVec2f_GrSLType, kDefault_GrSLPreci sion,
58 "ImageIncrement"); 58 "ImageIncrement");
59 59
60 const char* imgInc = args.fBuilder->getUniformCStr(fImageIncrementUni); 60 const char* imgInc = args.fBuilder->getUniformCStr(fImageIncrementUni);
61 const char* coeff = args.fBuilder->getUniformCStr(fCoefficientsUni); 61 const char* coeff = args.fBuilder->getUniformCStr(fCoefficientsUni);
62 62
63 SkString cubicBlendName; 63 SkString cubicBlendName;
64 64
65 static const GrGLShaderVar gCubicBlendArgs[] = { 65 static const GrGLSLShaderVar gCubicBlendArgs[] = {
66 GrGLShaderVar("coefficients", kMat44f_GrSLType), 66 GrGLSLShaderVar("coefficients", kMat44f_GrSLType),
67 GrGLShaderVar("t", kFloat_GrSLType), 67 GrGLSLShaderVar("t", kFloat_GrSLType),
68 GrGLShaderVar("c0", kVec4f_GrSLType), 68 GrGLSLShaderVar("c0", kVec4f_GrSLType),
69 GrGLShaderVar("c1", kVec4f_GrSLType), 69 GrGLSLShaderVar("c1", kVec4f_GrSLType),
70 GrGLShaderVar("c2", kVec4f_GrSLType), 70 GrGLSLShaderVar("c2", kVec4f_GrSLType),
71 GrGLShaderVar("c3", kVec4f_GrSLType), 71 GrGLSLShaderVar("c3", kVec4f_GrSLType),
72 }; 72 };
73 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder(); 73 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
74 SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0); 74 SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
75 fsBuilder->emitFunction(kVec4f_GrSLType, 75 fsBuilder->emitFunction(kVec4f_GrSLType,
76 "cubicBlend", 76 "cubicBlend",
77 SK_ARRAY_COUNT(gCubicBlendArgs), 77 SK_ARRAY_COUNT(gCubicBlendArgs),
78 gCubicBlendArgs, 78 gCubicBlendArgs,
79 "\tvec4 ts = vec4(1.0, t, t * t, t * t * t);\n" 79 "\tvec4 ts = vec4(1.0, t, t * t, t * t * t);\n"
80 "\tvec4 c = coefficients * ts;\n" 80 "\tvec4 c = coefficients * ts;\n"
81 "\treturn c.x * c0 + c.y * c1 + c.z * c2 + c.w * c3; \n", 81 "\treturn c.x * c0 + c.y * c1 + c.z * c2 + c.w * c3; \n",
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // Use bilerp to handle rotation or fractional translation. 207 // Use bilerp to handle rotation or fractional translation.
208 *filterMode = GrTextureParams::kBilerp_FilterMode; 208 *filterMode = GrTextureParams::kBilerp_FilterMode;
209 } 209 }
210 return false; 210 return false;
211 } 211 }
212 // When we use the bicubic filtering effect each sample is read from the tex ture using 212 // When we use the bicubic filtering effect each sample is read from the tex ture using
213 // nearest neighbor sampling. 213 // nearest neighbor sampling.
214 *filterMode = GrTextureParams::kNone_FilterMode; 214 *filterMode = GrTextureParams::kNone_FilterMode;
215 return true; 215 return true;
216 } 216 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBezierEffect.cpp ('k') | src/gpu/effects/GrConfigConversionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698