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

Side by Side Diff: src/gpu/GrDrawState.cpp

Issue 628633003: gl programs rewrite (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
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 "GrDrawState.h" 8 #include "GrDrawState.h"
9 9
10 #include "GrOptDrawState.h" 10 #include "GrOptDrawState.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 if (this->isCoverageDrawing()) { 420 if (this->isCoverageDrawing()) {
421 return true; 421 return true;
422 } 422 }
423 423
424 GrProcessor::InvariantOutput inout; 424 GrProcessor::InvariantOutput inout;
425 inout.fIsSingleComponent = false; 425 inout.fIsSingleComponent = false;
426 // Initialize to an unknown starting coverage if per-vertex coverage is spec ified. 426 // Initialize to an unknown starting coverage if per-vertex coverage is spec ified.
427 if (this->hasCoverageVertexAttribute()) { 427 if (this->hasCoverageVertexAttribute()) {
428 inout.fValidFlags = 0; 428 inout.fValidFlags = 0;
429 } else { 429 } else {
430 inout.fColor = fCoverage; 430 inout.fColor = this->getCoverageColor();
431 inout.fValidFlags = kRGBA_GrColorComponentFlags; 431 inout.fValidFlags = kRGBA_GrColorComponentFlags;
432 } 432 }
433 433
434 // Run through the coverage stages and see if the coverage will be all ones at the end. 434 // Run through the coverage stages and see if the coverage will be all ones at the end.
435 if (this->hasGeometryProcessor()) { 435 if (this->hasGeometryProcessor()) {
436 const GrGeometryProcessor* gp = fGeometryProcessor->getGeometryProcessor (); 436 const GrGeometryProcessor* gp = fGeometryProcessor->getGeometryProcessor ();
437 gp->computeInvariantOutput(&inout); 437 gp->computeInvariantOutput(&inout);
438 } 438 }
439
439 for (int s = 0; s < this->numCoverageStages(); ++s) { 440 for (int s = 0; s < this->numCoverageStages(); ++s) {
440 const GrProcessor* processor = this->getCoverageStage(s).getProcessor(); 441 const GrProcessor* processor = this->getCoverageStage(s).getProcessor();
441 processor->computeInvariantOutput(&inout); 442 processor->computeInvariantOutput(&inout);
442 } 443 }
443 return inout.isSolidWhite(); 444 return inout.isSolidWhite();
444 } 445 }
445 446
446 ////////////////////////////////////////////////////////////////////////////// 447 //////////////////////////////////////////////////////////////////////////////
447 448
448 GrDrawState::AutoVertexAttribRestore::AutoVertexAttribRestore(GrDrawState* drawS tate) { 449 GrDrawState::AutoVertexAttribRestore::AutoVertexAttribRestore(GrDrawState* drawS tate) {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 //////////////////////////////////////////////////////////////////////////////// 657 ////////////////////////////////////////////////////////////////////////////////
657 658
658 GrDrawState::~GrDrawState() { 659 GrDrawState::~GrDrawState() {
659 SkSafeUnref(fCachedOptState); 660 SkSafeUnref(fCachedOptState);
660 SkASSERT(0 == fBlockEffectRemovalCnt); 661 SkASSERT(0 == fBlockEffectRemovalCnt);
661 } 662 }
662 663
663 //////////////////////////////////////////////////////////////////////////////// 664 ////////////////////////////////////////////////////////////////////////////////
664 665
665 GrDrawState::BlendOptFlags GrDrawState::getBlendOpts(bool forceCoverage, 666 GrDrawState::BlendOptFlags GrDrawState::getBlendOpts(bool forceCoverage,
666 GrBlendCoeff* srcCoeff, 667 GrBlendCoeff* srcCoeff,
667 GrBlendCoeff* dstCoeff) const { 668 GrBlendCoeff* dstCoeff) con st {
668 GrBlendCoeff bogusSrcCoeff, bogusDstCoeff; 669 GrBlendCoeff bogusSrcCoeff, bogusDstCoeff;
669 if (NULL == srcCoeff) { 670 if (NULL == srcCoeff) {
670 srcCoeff = &bogusSrcCoeff; 671 srcCoeff = &bogusSrcCoeff;
671 } 672 }
672 if (NULL == dstCoeff) { 673 if (NULL == dstCoeff) {
673 dstCoeff = &bogusDstCoeff; 674 dstCoeff = &bogusDstCoeff;
674 } 675 }
675 676
676 *srcCoeff = this->getSrcBlendCoeff(); 677 *srcCoeff = this->getSrcBlendCoeff();
677 *dstCoeff = this->getDstBlendCoeff(); 678 *dstCoeff = this->getDstBlendCoeff();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 800 }
800 801
801 // Since the shader will multiply coverage and color, the only way the f inal A==1 is if 802 // Since the shader will multiply coverage and color, the only way the f inal A==1 is if
802 // coverage and color both have A==1. 803 // coverage and color both have A==1.
803 return (inoutColor.isOpaque() && inoutCoverage.isOpaque()); 804 return (inoutColor.isOpaque() && inoutCoverage.isOpaque());
804 } 805 }
805 806
806 return inoutColor.isOpaque(); 807 return inoutColor.isOpaque();
807 } 808 }
808 809
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698