| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 void GrGLSLShaderBuilder::appendTextureLookupAndModulate(const char* modulation, | 106 void GrGLSLShaderBuilder::appendTextureLookupAndModulate(const char* modulation, |
| 107 const GrGLSLTextureSamp
ler& sampler, | 107 const GrGLSLTextureSamp
ler& sampler, |
| 108 const char* coordName, | 108 const char* coordName, |
| 109 GrSLType varyingType) { | 109 GrSLType varyingType) { |
| 110 SkString lookup; | 110 SkString lookup; |
| 111 this->appendTextureLookup(&lookup, sampler, coordName, varyingType); | 111 this->appendTextureLookup(&lookup, sampler, coordName, varyingType); |
| 112 this->codeAppend((GrGLSLExpr4(modulation) * GrGLSLExpr4(lookup)).c_str()); | 112 this->codeAppend((GrGLSLExpr4(modulation) * GrGLSLExpr4(lookup)).c_str()); |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool GrGLSLShaderBuilder::addFeature(uint32_t featureBit, const char* extensionN
ame) { | 115 void GrGLSLShaderBuilder::addFeature(uint32_t featureBit, const char* extensionN
ame) { |
| 116 if (featureBit & fFeaturesAddedMask) { | 116 if (!(featureBit & fFeaturesAddedMask)) { |
| 117 return false; | 117 this->extensions().appendf("#extension %s: require\n", extensionName); |
| 118 fFeaturesAddedMask |= featureBit; |
| 118 } | 119 } |
| 119 this->extensions().appendf("#extension %s: require\n", extensionName); | |
| 120 fFeaturesAddedMask |= featureBit; | |
| 121 return true; | |
| 122 } | 120 } |
| 123 | 121 |
| 124 void GrGLSLShaderBuilder::appendDecls(const VarArray& vars, SkString* out) const
{ | 122 void GrGLSLShaderBuilder::appendDecls(const VarArray& vars, SkString* out) const
{ |
| 125 for (int i = 0; i < vars.count(); ++i) { | 123 for (int i = 0; i < vars.count(); ++i) { |
| 126 vars[i].appendDecl(fProgramBuilder->glslCaps(), out); | 124 vars[i].appendDecl(fProgramBuilder->glslCaps(), out); |
| 127 out->append(";\n"); | 125 out->append(";\n"); |
| 128 } | 126 } |
| 129 } | 127 } |
| 130 | 128 |
| 131 void GrGLSLShaderBuilder::addLayoutQualifier(const char* param, InterfaceQualifi
er interface) { | 129 void GrGLSLShaderBuilder::addLayoutQualifier(const char* param, InterfaceQualifi
er interface) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 this->code().append("}"); | 166 this->code().append("}"); |
| 169 | 167 |
| 170 for (int i = 0; i <= fCodeIndex; i++) { | 168 for (int i = 0; i <= fCodeIndex; i++) { |
| 171 fCompilerStrings[i] = fShaderStrings[i].c_str(); | 169 fCompilerStrings[i] = fShaderStrings[i].c_str(); |
| 172 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); | 170 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); |
| 173 } | 171 } |
| 174 | 172 |
| 175 fFinalized = true; | 173 fFinalized = true; |
| 176 } | 174 } |
| 177 | 175 |
| OLD | NEW |