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

Side by Side Diff: src/gpu/glsl/GrGLSLShaderBuilder.cpp

Issue 1881513002: Add appendPrecisionModifier method to GrGLSLShaderBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/glsl/GrGLSLShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLShaderVar.h » ('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 "GrSwizzle.h" 8 #include "GrSwizzle.h"
9 #include "glsl/GrGLSLShaderBuilder.h" 9 #include "glsl/GrGLSLShaderBuilder.h"
10 #include "glsl/GrGLSLCaps.h" 10 #include "glsl/GrGLSLCaps.h"
(...skipping 17 matching lines...) Expand all
28 28
29 this->main() = "void main() {"; 29 this->main() = "void main() {";
30 } 30 }
31 31
32 void GrGLSLShaderBuilder::declAppend(const GrGLSLShaderVar& var) { 32 void GrGLSLShaderBuilder::declAppend(const GrGLSLShaderVar& var) {
33 SkString tempDecl; 33 SkString tempDecl;
34 var.appendDecl(fProgramBuilder->glslCaps(), &tempDecl); 34 var.appendDecl(fProgramBuilder->glslCaps(), &tempDecl);
35 this->codeAppendf("%s;", tempDecl.c_str()); 35 this->codeAppendf("%s;", tempDecl.c_str());
36 } 36 }
37 37
38 void GrGLSLShaderBuilder::appendPrecisionModifier(GrSLPrecision precision) {
39 if (fProgramBuilder->glslCaps()->usesPrecisionModifiers()) {
40 this->codeAppendf("%s ", GrGLSLPrecisionString(precision));
41 }
42 }
43
38 void GrGLSLShaderBuilder::emitFunction(GrSLType returnType, 44 void GrGLSLShaderBuilder::emitFunction(GrSLType returnType,
39 const char* name, 45 const char* name,
40 int argCnt, 46 int argCnt,
41 const GrGLSLShaderVar* args, 47 const GrGLSLShaderVar* args,
42 const char* body, 48 const char* body,
43 SkString* outName) { 49 SkString* outName) {
44 this->functions().append(GrGLSLTypeString(returnType)); 50 this->functions().append(GrGLSLTypeString(returnType));
45 fProgramBuilder->nameVariable(outName, '\0', name); 51 fProgramBuilder->nameVariable(outName, '\0', name);
46 this->functions().appendf(" %s", outName->c_str()); 52 this->functions().appendf(" %s", outName->c_str());
47 this->functions().append("("); 53 this->functions().append("(");
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // append the 'footer' to code 173 // append the 'footer' to code
168 this->code().append("}"); 174 this->code().append("}");
169 175
170 for (int i = 0; i <= fCodeIndex; i++) { 176 for (int i = 0; i <= fCodeIndex; i++) {
171 fCompilerStrings[i] = fShaderStrings[i].c_str(); 177 fCompilerStrings[i] = fShaderStrings[i].c_str();
172 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); 178 fCompilerStringLengths[i] = (int)fShaderStrings[i].size();
173 } 179 }
174 180
175 fFinalized = true; 181 fFinalized = true;
176 } 182 }
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLShaderVar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698