| 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 "GrGLSLFragmentShaderBuilder.h" | 8 #include "GrGLSLFragmentShaderBuilder.h" |
| 9 #include "GrRenderTarget.h" | 9 #include "GrRenderTarget.h" |
| 10 #include "GrRenderTargetPriv.h" | 10 #include "GrRenderTargetPriv.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // output. The condition also co-incides with the condition in whici GLES SL
2.0 | 314 // output. The condition also co-incides with the condition in whici GLES SL
2.0 |
| 315 // requires the built-in gl_SecondaryFragColorEXT, where as 3.0 requires a c
ustom output. | 315 // requires the built-in gl_SecondaryFragColorEXT, where as 3.0 requires a c
ustom output. |
| 316 if (caps.mustDeclareFragmentShaderOutput()) { | 316 if (caps.mustDeclareFragmentShaderOutput()) { |
| 317 fOutputs.push_back().set(kVec4f_GrSLType, GrGLSLShaderVar::kOut_TypeModi
fier, | 317 fOutputs.push_back().set(kVec4f_GrSLType, GrGLSLShaderVar::kOut_TypeModi
fier, |
| 318 DeclaredSecondaryColorOutputName()); | 318 DeclaredSecondaryColorOutputName()); |
| 319 fProgramBuilder->finalizeFragmentSecondaryColor(fOutputs.back()); | 319 fProgramBuilder->finalizeFragmentSecondaryColor(fOutputs.back()); |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 const char* GrGLSLFragmentShaderBuilder::getPrimaryColorOutputName() const { | 323 const char* GrGLSLFragmentShaderBuilder::getPrimaryColorOutputName() const { |
| 324 return fHasCustomColorOutput ? DeclaredColorOutputName() : "sk_FragColor"; | 324 return fHasCustomColorOutput ? DeclaredColorOutputName() : "gl_FragColor"; |
| 325 } | 325 } |
| 326 | 326 |
| 327 void GrGLSLFragmentBuilder::declAppendf(const char* fmt, ...) { | 327 void GrGLSLFragmentBuilder::declAppendf(const char* fmt, ...) { |
| 328 va_list argp; | 328 va_list argp; |
| 329 va_start(argp, fmt); | 329 va_start(argp, fmt); |
| 330 inputs().appendVAList(fmt, argp); | 330 inputs().appendVAList(fmt, argp); |
| 331 va_end(argp); | 331 va_end(argp); |
| 332 } | 332 } |
| 333 | 333 |
| 334 const char* GrGLSLFragmentShaderBuilder::getSecondaryColorOutputName() const { | 334 const char* GrGLSLFragmentShaderBuilder::getSecondaryColorOutputName() const { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); | 391 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); |
| 392 } | 392 } |
| 393 | 393 |
| 394 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { | 394 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { |
| 395 SkASSERT(fSubstageIndices.count() >= 2); | 395 SkASSERT(fSubstageIndices.count() >= 2); |
| 396 fSubstageIndices.pop_back(); | 396 fSubstageIndices.pop_back(); |
| 397 fSubstageIndices.back()++; | 397 fSubstageIndices.back()++; |
| 398 int removeAt = fMangleString.findLastOf('_'); | 398 int removeAt = fMangleString.findLastOf('_'); |
| 399 fMangleString.remove(removeAt, fMangleString.size() - removeAt); | 399 fMangleString.remove(removeAt, fMangleString.size() - removeAt); |
| 400 } | 400 } |
| OLD | NEW |