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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 glslCaps->fbFetchExtensionString()); | 259 glslCaps->fbFetchExtensionString()); |
260 | 260 |
261 // Some versions of this extension string require declaring custom color
output on ES 3.0+ | 261 // Some versions of this extension string require declaring custom color
output on ES 3.0+ |
262 const char* fbFetchColorName = glslCaps->fbFetchColorName(); | 262 const char* fbFetchColorName = glslCaps->fbFetchColorName(); |
263 if (glslCaps->fbFetchNeedsCustomOutput()) { | 263 if (glslCaps->fbFetchNeedsCustomOutput()) { |
264 this->enableCustomOutput(); | 264 this->enableCustomOutput(); |
265 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu
t_TypeModifier); | 265 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu
t_TypeModifier); |
266 fbFetchColorName = DeclaredColorOutputName(); | 266 fbFetchColorName = DeclaredColorOutputName(); |
267 // Set the dstColor to an intermediate variable so we don't override
it with the output | 267 // Set the dstColor to an intermediate variable so we don't override
it with the output |
268 this->codeAppendf("vec4 %s = %s;", kDstColorName, fbFetchColorName); | 268 this->codeAppendf("vec4 %s = %s;", kDstColorName, fbFetchColorName); |
| 269 } else { |
| 270 return fbFetchColorName; |
269 } | 271 } |
270 } | 272 } |
271 return kDstColorName; | 273 return kDstColorName; |
272 } | 274 } |
273 | 275 |
274 void GrGLSLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEqu
ation equation) { | 276 void GrGLSLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEqu
ation equation) { |
275 SkASSERT(GrBlendEquationIsAdvanced(equation)); | 277 SkASSERT(GrBlendEquationIsAdvanced(equation)); |
276 | 278 |
277 const GrGLSLCaps& caps = *fProgramBuilder->glslCaps(); | 279 const GrGLSLCaps& caps = *fProgramBuilder->glslCaps(); |
278 if (!caps.mustEnableAdvBlendEqs()) { | 280 if (!caps.mustEnableAdvBlendEqs()) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); | 391 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); |
390 } | 392 } |
391 | 393 |
392 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { | 394 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { |
393 SkASSERT(fSubstageIndices.count() >= 2); | 395 SkASSERT(fSubstageIndices.count() >= 2); |
394 fSubstageIndices.pop_back(); | 396 fSubstageIndices.pop_back(); |
395 fSubstageIndices.back()++; | 397 fSubstageIndices.back()++; |
396 int removeAt = fMangleString.findLastOf('_'); | 398 int removeAt = fMangleString.findLastOf('_'); |
397 fMangleString.remove(removeAt, fMangleString.size() - removeAt); | 399 fMangleString.remove(removeAt, fMangleString.size() - removeAt); |
398 } | 400 } |
OLD | NEW |