OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "gl/GrGLShaderBuilder.h" | 8 #include "gl/GrGLShaderBuilder.h" |
9 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
10 #include "gl/GrGLUniformHandle.h" | 10 #include "gl/GrGLUniformHandle.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 if (out->endsWith('_')) { | 330 if (out->endsWith('_')) { |
331 // Names containing "__" are reserved. | 331 // Names containing "__" are reserved. |
332 out->append("x"); | 332 out->append("x"); |
333 } | 333 } |
334 out->appendf("_Stage%d", fCodeStage.stageIndex()); | 334 out->appendf("_Stage%d", fCodeStage.stageIndex()); |
335 } | 335 } |
336 } | 336 } |
337 | 337 |
338 const char* GrGLShaderBuilder::dstColor() { | 338 const char* GrGLShaderBuilder::dstColor() { |
339 if (fCodeStage.inStageCode()) { | 339 if (fCodeStage.inStageCode()) { |
340 const GrEffectRef& effect = *fCodeStage.effectStage()->getEffect(); | 340 const GrEffect* effect = fCodeStage.effectStage()->getEffect(); |
341 if (!effect->willReadDstColor()) { | 341 if (!effect->willReadDstColor()) { |
342 SkDEBUGFAIL("GrGLEffect asked for dst color but its generating GrEff
ect " | 342 SkDEBUGFAIL("GrGLEffect asked for dst color but its generating GrEff
ect " |
343 "did not request access."); | 343 "did not request access."); |
344 return ""; | 344 return ""; |
345 } | 345 } |
346 } | 346 } |
347 static const char kFBFetchColorName[] = "gl_LastFragData[0]"; | 347 static const char kFBFetchColorName[] = "gl_LastFragData[0]"; |
348 GrGLCaps::FBFetchType fetchType = fGpu->glCaps().fbFetchType(); | 348 GrGLCaps::FBFetchType fetchType = fGpu->glCaps().fbFetchType(); |
349 if (GrGLCaps::kEXT_FBFetchType == fetchType) { | 349 if (GrGLCaps::kEXT_FBFetchType == fetchType) { |
350 SkAssertResult(this->enablePrivateFeature(kEXTShaderFramebufferFetch_GLS
LPrivateFeature)); | 350 SkAssertResult(this->enablePrivateFeature(kEXTShaderFramebufferFetch_GLS
LPrivateFeature)); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 if (0 != index) { | 480 if (0 != index) { |
481 coords2D.appendf("_%i", index); | 481 coords2D.appendf("_%i", index); |
482 } | 482 } |
483 this->fsCodeAppendf("\tvec2 %s = %s.xy / %s.z;", | 483 this->fsCodeAppendf("\tvec2 %s = %s.xy / %s.z;", |
484 coords2D.c_str(), coords[index].c_str(), coords[index].c
_str()); | 484 coords2D.c_str(), coords[index].c_str(), coords[index].c
_str()); |
485 return coords2D; | 485 return coords2D; |
486 } | 486 } |
487 | 487 |
488 const char* GrGLShaderBuilder::fragmentPosition() { | 488 const char* GrGLShaderBuilder::fragmentPosition() { |
489 if (fCodeStage.inStageCode()) { | 489 if (fCodeStage.inStageCode()) { |
490 const GrEffectRef& effect = *fCodeStage.effectStage()->getEffect(); | 490 const GrEffect* effect = fCodeStage.effectStage()->getEffect(); |
491 if (!effect->willReadFragmentPosition()) { | 491 if (!effect->willReadFragmentPosition()) { |
492 SkDEBUGFAIL("GrGLEffect asked for frag position but its generating G
rEffect " | 492 SkDEBUGFAIL("GrGLEffect asked for frag position but its generating G
rEffect " |
493 "did not request access."); | 493 "did not request access."); |
494 return ""; | 494 return ""; |
495 } | 495 } |
496 } | 496 } |
497 // We only declare "gl_FragCoord" when we're in the case where we want to us
e layout qualifiers | 497 // We only declare "gl_FragCoord" when we're in the case where we want to us
e layout qualifiers |
498 // to reverse y. Otherwise it isn't necessary and whether the "in" qualifier
appears in the | 498 // to reverse y. Otherwise it isn't necessary and whether the "in" qualifier
appears in the |
499 // declaration varies in earlier GLSL specs. So it is simpler to omit it. | 499 // declaration varies in earlier GLSL specs. So it is simpler to omit it. |
500 if (fTopLeftFragPosRead) { | 500 if (fTopLeftFragPosRead) { |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 | 1099 |
1100 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this, | 1100 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this, |
1101 effectCnt); | 1101 effectCnt); |
1102 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder, | 1102 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder, |
1103 effectStages, | 1103 effectStages, |
1104 effectKeys, | 1104 effectKeys, |
1105 effectCnt, | 1105 effectCnt, |
1106 inOutFSColor); | 1106 inOutFSColor); |
1107 return pathTexGenEffectsBuilder.finish(); | 1107 return pathTexGenEffectsBuilder.finish(); |
1108 } | 1108 } |
OLD | NEW |