| 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 "GrGLShaderBuilder.h" | 8 #include "GrGLShaderBuilder.h" |
| 9 #include "gl/GrGLGpu.h" | 9 #include "gl/GrGLGpu.h" |
| 10 #include "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 173 GR_STATIC_ASSERT(0 == GrGLShaderBuilder::kOut_InterfaceQualifier); | 173 GR_STATIC_ASSERT(0 == GrGLShaderBuilder::kOut_InterfaceQualifier); |
| 174 GR_STATIC_ASSERT(SK_ARRAY_COUNT(interfaceQualifierNames) == kLastInterfaceQu
alifier + 1); | 174 GR_STATIC_ASSERT(SK_ARRAY_COUNT(interfaceQualifierNames) == kLastInterfaceQu
alifier + 1); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void GrGLShaderBuilder::finalize(uint32_t visibility) { | 177 void GrGLShaderBuilder::finalize(uint32_t visibility) { |
| 178 SkASSERT(!fFinalized); | 178 SkASSERT(!fFinalized); |
| 179 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); | 179 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); |
| 180 this->compileAndAppendLayoutQualifiers(); | 180 this->compileAndAppendLayoutQualifiers(); |
| 181 SkASSERT(visibility); |
| 181 fProgramBuilder->appendUniformDecls((GrGLProgramBuilder::ShaderVisibility) v
isibility, | 182 fProgramBuilder->appendUniformDecls((GrGLProgramBuilder::ShaderVisibility) v
isibility, |
| 182 &this->uniforms()); | 183 &this->uniforms()); |
| 183 this->appendDecls(fInputs, &this->inputs()); | 184 this->appendDecls(fInputs, &this->inputs()); |
| 184 SkASSERT(k110_GrGLSLGeneration != fProgramBuilder->glslCaps()->generation()
|| | 185 // We should not have any outputs in the fragment shader when using version
1.10 |
| 186 SkASSERT(GrGLProgramBuilder::kFragment_Visibility != visibility || |
| 187 k110_GrGLSLGeneration != fProgramBuilder->glslCaps()->generation()
|| |
| 185 fOutputs.empty()); | 188 fOutputs.empty()); |
| 186 this->appendDecls(fOutputs, &this->outputs()); | 189 this->appendDecls(fOutputs, &this->outputs()); |
| 187 this->onFinalize(); | 190 this->onFinalize(); |
| 188 // append the 'footer' to code | 191 // append the 'footer' to code |
| 189 this->code().append("}"); | 192 this->code().append("}"); |
| 190 | 193 |
| 191 for (int i = 0; i <= fCodeIndex; i++) { | 194 for (int i = 0; i <= fCodeIndex; i++) { |
| 192 fCompilerStrings[i] = fShaderStrings[i].c_str(); | 195 fCompilerStrings[i] = fShaderStrings[i].c_str(); |
| 193 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); | 196 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); |
| 194 } | 197 } |
| 195 | 198 |
| 196 fFinalized = true; | 199 fFinalized = true; |
| 197 } | 200 } |
| 198 | 201 |
| OLD | NEW |