Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 372773002: Remove use of GrEffectRef from draw state and below. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgramEffects.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramEffects.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698