| 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 "GrGLFragmentShaderBuilder.h" | 8 #include "GrGLFragmentShaderBuilder.h" |
| 9 #include "GrGLProgramBuilder.h" | 9 #include "GrGLProgramBuilder.h" |
| 10 #include "gl/GrGLGpu.h" | 10 #include "gl/GrGLGpu.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec)
{ | 296 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec)
{ |
| 297 v->fFsIn = v->fVsOut; | 297 v->fFsIn = v->fVsOut; |
| 298 if (v->fGsOut) { | 298 if (v->fGsOut) { |
| 299 v->fFsIn = v->fGsOut; | 299 v->fFsIn = v->fGsOut; |
| 300 } | 300 } |
| 301 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v-
>fFsIn, fsPrec); | 301 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v-
>fFsIn, fsPrec); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void GrGLFragmentBuilder::onBeforeChildProcEmitCode() { | 304 void GrGLFragmentBuilder::onBeforeChildProcEmitCode() { |
| 305 fSubstageIndices.back()++; | 305 SkASSERT(fSubstageIndices.count() >= 1); |
| 306 fSubstageIndices.push_back(0); | 306 fSubstageIndices.push_back(0); |
| 307 fMangleString.append(this->getMangleStringThisLevel()); | 307 // second-to-last value in the fSubstageIndices stack is the index of the ch
ild proc |
| 308 // at that level which is currently emitting code. |
| 309 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); |
| 308 } | 310 } |
| 309 | 311 |
| 310 void GrGLFragmentBuilder::onAfterChildProcEmitCode() { | 312 void GrGLFragmentBuilder::onAfterChildProcEmitCode() { |
| 313 SkASSERT(fSubstageIndices.count() >= 2); |
| 311 fSubstageIndices.pop_back(); | 314 fSubstageIndices.pop_back(); |
| 315 fSubstageIndices.back()++; |
| 312 int removeAt = fMangleString.findLastOf('_'); | 316 int removeAt = fMangleString.findLastOf('_'); |
| 313 fMangleString.remove(removeAt, fMangleString.size() - removeAt); | 317 fMangleString.remove(removeAt, fMangleString.size() - removeAt); |
| 314 } | 318 } |
| OLD | NEW |