OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |