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

Side by Side Diff: src/gpu/effects/GrPorterDuffXferProcessor.cpp

Issue 1116713002: Pull out shader-specific caps into GrShaderCaps and GrGLSLCaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up some comments Created 5 years, 7 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/effects/GrBezierEffect.h ('k') | src/gpu/gl/GrGLCaps.h » ('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 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 "effects/GrPorterDuffXferProcessor.h" 8 #include "effects/GrPorterDuffXferProcessor.h"
9 9
10 #include "GrBlend.h" 10 #include "GrBlend.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } else if (optFlags & kIgnoreCoverage_OptFlag) { 344 } else if (optFlags & kIgnoreCoverage_OptFlag) {
345 fPrimaryOutputType = kColor_PrimaryOutputType; 345 fPrimaryOutputType = kColor_PrimaryOutputType;
346 return; 346 return;
347 } 347 }
348 348
349 // If we do have coverage determine whether it matters. Dual source blendin g is expensive so 349 // If we do have coverage determine whether it matters. Dual source blendin g is expensive so
350 // we don't do it if we are doing coverage drawing. If we aren't then We al ways do dual source 350 // we don't do it if we are doing coverage drawing. If we aren't then We al ways do dual source
351 // blending if we have any effective coverage stages OR the geometry process or doesn't emits 351 // blending if we have any effective coverage stages OR the geometry process or doesn't emits
352 // solid coverage. 352 // solid coverage.
353 if (!(optFlags & kSetCoverageDrawing_OptFlag) && !hasSolidCoverage) { 353 if (!(optFlags & kSetCoverageDrawing_OptFlag) && !hasSolidCoverage) {
354 if (caps.dualSourceBlendingSupport()) { 354 if (caps.shaderCaps()->dualSourceBlendingSupport()) {
355 if (kZero_GrBlendCoeff == fDstBlend) { 355 if (kZero_GrBlendCoeff == fDstBlend) {
356 // write the coverage value to second color 356 // write the coverage value to second color
357 fSecondaryOutputType = kCoverage_SecondaryOutputType; 357 fSecondaryOutputType = kCoverage_SecondaryOutputType;
358 fDstBlend = kIS2C_GrBlendCoeff; 358 fDstBlend = kIS2C_GrBlendCoeff;
359 } else if (kSA_GrBlendCoeff == fDstBlend) { 359 } else if (kSA_GrBlendCoeff == fDstBlend) {
360 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered. 360 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered.
361 fSecondaryOutputType = kCoverageISA_SecondaryOutputType; 361 fSecondaryOutputType = kCoverageISA_SecondaryOutputType;
362 fDstBlend = kIS2C_GrBlendCoeff; 362 fDstBlend = kIS2C_GrBlendCoeff;
363 } else if (kSC_GrBlendCoeff == fDstBlend) { 363 } else if (kSC_GrBlendCoeff == fDstBlend) {
364 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered. 364 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered.
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 break; 661 break;
662 } 662 }
663 663
664 output->fWillBlendWithDst = false; 664 output->fWillBlendWithDst = false;
665 } 665 }
666 666
667 bool GrPorterDuffXPFactory::willReadDstColor(const GrDrawTargetCaps& caps, 667 bool GrPorterDuffXPFactory::willReadDstColor(const GrDrawTargetCaps& caps,
668 const GrProcOptInfo& colorPOI, 668 const GrProcOptInfo& colorPOI,
669 const GrProcOptInfo& coveragePOI) c onst { 669 const GrProcOptInfo& coveragePOI) c onst {
670 // We can always blend correctly if we have dual source blending. 670 // We can always blend correctly if we have dual source blending.
671 if (caps.dualSourceBlendingSupport()) { 671 if (caps.shaderCaps()->dualSourceBlendingSupport()) {
672 return false; 672 return false;
673 } 673 }
674 674
675 if (this->canTweakAlphaForCoverage()) { 675 if (this->canTweakAlphaForCoverage()) {
676 return false; 676 return false;
677 } 677 }
678 678
679 bool srcAIsOne = colorPOI.isOpaque(); 679 bool srcAIsOne = colorPOI.isOpaque();
680 680
681 if (kZero_GrBlendCoeff == fDstCoeff) { 681 if (kZero_GrBlendCoeff == fDstCoeff) {
(...skipping 18 matching lines...) Expand all
700 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); 700 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
701 701
702 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random, 702 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random,
703 GrContext*, 703 GrContext*,
704 const GrDrawTargetCaps&, 704 const GrDrawTargetCaps&,
705 GrTexture*[]) { 705 GrTexture*[]) {
706 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode)); 706 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode));
707 return GrPorterDuffXPFactory::Create(mode); 707 return GrPorterDuffXPFactory::Create(mode);
708 } 708 }
709 709
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBezierEffect.h ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698