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

Side by Side Diff: bench/GLVertexAttributesBench.cpp

Issue 2408193002: 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/GLVec4ScalarBench.cpp ('k') | gyp/sksl.gyp » ('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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImageEncoder.h" 10 #include "SkImageEncoder.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 vshaderTxt.appendf("%s = %s;\n", oVars[i].c_str(), aVars[i].c_str()); 107 vshaderTxt.appendf("%s = %s;\n", oVars[i].c_str(), aVars[i].c_str());
108 } 108 }
109 109
110 // Passthrough position as a dummy 110 // Passthrough position as a dummy
111 for (uint32_t i = attribs; i < maxAttribs; i++) { 111 for (uint32_t i = attribs; i < maxAttribs; i++) {
112 vshaderTxt.appendf("%s = vec4(0, 0, 0, 1);\n", oVars[i].c_str()); 112 vshaderTxt.appendf("%s = vec4(0, 0, 0, 1);\n", oVars[i].c_str());
113 } 113 }
114 114
115 vshaderTxt.append("}\n"); 115 vshaderTxt.append("}\n");
116 116
117 const GrGLInterface* gl = ctx->interface();
118
117 // setup fragment shader 119 // setup fragment shader
118 GrGLSLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut _TypeModifier); 120 GrGLSLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut _TypeModifier);
119 SkString fshaderTxt(version); 121 SkString fshaderTxt(version);
120 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps, &fshaderTxt); 122 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps, &fshaderTxt);
121 123
122 const char* fsOutName; 124 const char* fsOutName;
123 if (glslCaps->mustDeclareFragmentShaderOutput()) { 125 if (glslCaps->mustDeclareFragmentShaderOutput()) {
124 oFragColor.appendDecl(glslCaps, &fshaderTxt); 126 oFragColor.appendDecl(glslCaps, &fshaderTxt);
125 fshaderTxt.append(";\n"); 127 fshaderTxt.append(";\n");
126 fsOutName = oFragColor.c_str(); 128 fsOutName = oFragColor.c_str();
127 } else { 129 } else {
128 fsOutName = "sk_FragColor"; 130 fsOutName = "gl_FragColor";
129 } 131 }
130 132
131 for (uint32_t i = 0; i < maxAttribs; i++) { 133 for (uint32_t i = 0; i < maxAttribs; i++) {
132 oVars[i].setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); 134 oVars[i].setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier);
133 oVars[i].appendDecl(glslCaps, &fshaderTxt); 135 oVars[i].appendDecl(glslCaps, &fshaderTxt);
134 fshaderTxt.append(";\n"); 136 fshaderTxt.append(";\n");
135 } 137 }
136 138
137 fshaderTxt.appendf( 139 fshaderTxt.appendf(
138 "void main()\n" 140 "void main()\n"
139 "{\n" 141 "{\n"
140 "%s = ", fsOutName); 142 "%s = ", fsOutName);
141 143
142 fshaderTxt.appendf("%s", oVars[0].c_str()); 144 fshaderTxt.appendf("%s", oVars[0].c_str());
143 for (uint32_t i = 1; i < maxAttribs; i++) { 145 for (uint32_t i = 1; i < maxAttribs; i++) {
144 fshaderTxt.appendf(" + %s", oVars[i].c_str()); 146 fshaderTxt.appendf(" + %s", oVars[i].c_str());
145 } 147 }
146 148
147 fshaderTxt.append(";\n" 149 fshaderTxt.append(";\n"
148 "}\n"); 150 "}\n");
149 151
150 return CreateProgram(ctx, vshaderTxt.c_str(), fshaderTxt.c_str()); 152 return CreateProgram(gl, vshaderTxt.c_str(), fshaderTxt.c_str());
151 } 153 }
152 154
153 //////////////////////////////////////////////////////////////////////////////// /////////////////// 155 //////////////////////////////////////////////////////////////////////////////// ///////////////////
154 156
155 void GLVertexAttributesBench::setup(const GrGLContext* ctx) { 157 void GLVertexAttributesBench::setup(const GrGLContext* ctx) {
156 const GrGLInterface* gl = ctx->interface(); 158 const GrGLInterface* gl = ctx->interface();
157 fTexture = SetupFramebuffer(gl, kScreenWidth, kScreenHeight); 159 fTexture = SetupFramebuffer(gl, kScreenWidth, kScreenHeight);
158 160
159 fProgram = setupShader(ctx, fAttribs, kMaxAttribs); 161 fProgram = setupShader(ctx, fAttribs, kMaxAttribs);
160 162
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 261
260 DEF_BENCH( return new GLVertexAttributesBench(0) ) 262 DEF_BENCH( return new GLVertexAttributesBench(0) )
261 DEF_BENCH( return new GLVertexAttributesBench(1) ) 263 DEF_BENCH( return new GLVertexAttributesBench(1) )
262 DEF_BENCH( return new GLVertexAttributesBench(2) ) 264 DEF_BENCH( return new GLVertexAttributesBench(2) )
263 DEF_BENCH( return new GLVertexAttributesBench(3) ) 265 DEF_BENCH( return new GLVertexAttributesBench(3) )
264 DEF_BENCH( return new GLVertexAttributesBench(4) ) 266 DEF_BENCH( return new GLVertexAttributesBench(4) )
265 DEF_BENCH( return new GLVertexAttributesBench(5) ) 267 DEF_BENCH( return new GLVertexAttributesBench(5) )
266 DEF_BENCH( return new GLVertexAttributesBench(6) ) 268 DEF_BENCH( return new GLVertexAttributesBench(6) )
267 DEF_BENCH( return new GLVertexAttributesBench(7) ) 269 DEF_BENCH( return new GLVertexAttributesBench(7) )
268 #endif 270 #endif
OLDNEW
« no previous file with comments | « bench/GLVec4ScalarBench.cpp ('k') | gyp/sksl.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698