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 "glsl/GrGLSLShaderBuilder.h" | 8 #include "glsl/GrGLSLShaderBuilder.h" |
9 #include "glsl/GrGLSLCaps.h" | 9 #include "glsl/GrGLSLCaps.h" |
10 #include "glsl/GrGLSLShaderVar.h" | 10 #include "glsl/GrGLSLShaderVar.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 | 184 |
185 void GrGLSLShaderBuilder::finalize(uint32_t visibility) { | 185 void GrGLSLShaderBuilder::finalize(uint32_t visibility) { |
186 SkASSERT(!fFinalized); | 186 SkASSERT(!fFinalized); |
187 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); | 187 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); |
188 this->compileAndAppendLayoutQualifiers(); | 188 this->compileAndAppendLayoutQualifiers(); |
189 SkASSERT(visibility); | 189 SkASSERT(visibility); |
190 fProgramBuilder->appendUniformDecls((GrGLSLProgramBuilder::ShaderVisibility)
visibility, | 190 fProgramBuilder->appendUniformDecls((GrGLSLProgramBuilder::ShaderVisibility)
visibility, |
191 &this->uniforms()); | 191 &this->uniforms()); |
192 this->appendDecls(fInputs, &this->inputs()); | 192 this->appendDecls(fInputs, &this->inputs()); |
193 // We should not have any outputs in the fragment shader when using version
1.10 | |
194 SkASSERT(GrGLSLProgramBuilder::kFragment_Visibility != visibility || | |
195 k110_GrGLSLGeneration != fProgramBuilder->glslCaps()->generation()
|| | |
196 fOutputs.empty()); | |
197 this->appendDecls(fOutputs, &this->outputs()); | 193 this->appendDecls(fOutputs, &this->outputs()); |
198 this->onFinalize(); | 194 this->onFinalize(); |
199 // append the 'footer' to code | 195 // append the 'footer' to code |
200 this->code().append("}"); | 196 this->code().append("}"); |
201 | 197 |
202 for (int i = 0; i <= fCodeIndex; i++) { | 198 for (int i = 0; i <= fCodeIndex; i++) { |
203 fCompilerStrings[i] = fShaderStrings[i].c_str(); | 199 fCompilerStrings[i] = fShaderStrings[i].c_str(); |
204 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); | 200 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); |
205 } | 201 } |
206 | 202 |
207 fFinalized = true; | 203 fFinalized = true; |
208 } | 204 } |
209 | 205 |
OLD | NEW |