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

Side by Side Diff: bench/GLVec4ScalarBench.cpp

Issue 2408053002: Revert of Turned on SkSL->GLSL compiler (Closed)
Patch Set: Created 4 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 | « bench/GLInstancedArraysBench.cpp ('k') | bench/GLVertexAttributesBench.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 2015 Google Inc. 2 * Copyright 2015 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 "SkMatrix.h" 8 #include "SkMatrix.h"
9 #include "SkPoint.h" 9 #include "SkPoint.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 vshaderTxt.append(";\n"); 117 vshaderTxt.append(";\n");
118 118
119 vshaderTxt.append( 119 vshaderTxt.append(
120 "void main()\n" 120 "void main()\n"
121 "{\n" 121 "{\n"
122 " gl_Position = vec4(a_position, 0.0, 1.0);\n" 122 " gl_Position = vec4(a_position, 0.0, 1.0);\n"
123 " o_position = a_position;\n" 123 " o_position = a_position;\n"
124 " o_color = a_color;\n" 124 " o_color = a_color;\n"
125 "}\n"); 125 "}\n");
126 126
127 const GrGLInterface* gl = ctx->interface();
128
127 // set up fragment shader; this fragment shader will have fNumStages coverag e stages plus an 129 // set up fragment shader; this fragment shader will have fNumStages coverag e stages plus an
128 // XP stage at the end. Each coverage stage computes the pixel's distance f rom some hard- 130 // XP stage at the end. Each coverage stage computes the pixel's distance f rom some hard-
129 // coded center and compare that to some hard-coded circle radius to compute a coverage. 131 // coded center and compare that to some hard-coded circle radius to compute a coverage.
130 // Then, this coverage is mixed with the coverage from the previous stage an d passed to the 132 // Then, this coverage is mixed with the coverage from the previous stage an d passed to the
131 // next stage. 133 // next stage.
132 GrGLSLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut _TypeModifier); 134 GrGLSLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut _TypeModifier);
133 SkString fshaderTxt(version); 135 SkString fshaderTxt(version);
134 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps, &fshaderTxt); 136 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps, &fshaderTxt);
135 oPosition.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); 137 oPosition.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier);
136 oPosition.appendDecl(glslCaps, &fshaderTxt); 138 oPosition.appendDecl(glslCaps, &fshaderTxt);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ); 179 );
178 radius *= 0.8f; 180 radius *= 0.8f;
179 } 181 }
180 fshaderTxt.appendf( 182 fshaderTxt.appendf(
181 " {\n" 183 " {\n"
182 " %s = outputColor * outputCoverage;\n" 184 " %s = outputColor * outputCoverage;\n"
183 " }\n" 185 " }\n"
184 "}\n", 186 "}\n",
185 fsOutName); 187 fsOutName);
186 188
187 return CreateProgram(ctx, vshaderTxt.c_str(), fshaderTxt.c_str()); 189 return CreateProgram(gl, vshaderTxt.c_str(), fshaderTxt.c_str());
188 } 190 }
189 191
190 template<typename Func> 192 template<typename Func>
191 static void setup_matrices(int numQuads, Func f) { 193 static void setup_matrices(int numQuads, Func f) {
192 // We draw a really small triangle so we are not fill rate limited 194 // We draw a really small triangle so we are not fill rate limited
193 for (int i = 0 ; i < numQuads; i++) { 195 for (int i = 0 ; i < numQuads; i++) {
194 SkMatrix m = SkMatrix::I(); 196 SkMatrix m = SkMatrix::I();
195 m.setScale(0.01f, 0.01f); 197 m.setScale(0.01f, 0.01f);
196 f(m); 198 f(m);
197 } 199 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseScalar_CoverageSe tup, 2) ) 295 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseScalar_CoverageSe tup, 2) )
294 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseVec4_CoverageSetu p, 2) ) 296 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseVec4_CoverageSetu p, 2) )
295 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseScalar_CoverageSe tup, 4) ) 297 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseScalar_CoverageSe tup, 4) )
296 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseVec4_CoverageSetu p, 4) ) 298 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseVec4_CoverageSetu p, 4) )
297 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseScalar_CoverageSe tup, 6) ) 299 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseScalar_CoverageSe tup, 6) )
298 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseVec4_CoverageSetu p, 6) ) 300 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseVec4_CoverageSetu p, 6) )
299 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseScalar_CoverageSe tup, 8) ) 301 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseScalar_CoverageSe tup, 8) )
300 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseVec4_CoverageSetu p, 8) ) 302 DEF_BENCH( return new GLVec4ScalarBench(GLVec4ScalarBench::kUseVec4_CoverageSetu p, 8) )
301 303
302 #endif 304 #endif
OLDNEW
« no previous file with comments | « bench/GLInstancedArraysBench.cpp ('k') | bench/GLVertexAttributesBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698