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

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

Issue 1287973003: Check for xfer barriers in GrBatch, auto-issue barriers in GrGpu (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 5 years, 4 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/batches/GrTestBatch.h ('k') | src/gpu/effects/GrDashingEffect.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 2015 Google Inc. 2 * Copyright 2015 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/GrCustomXfermode.h" 8 #include "effects/GrCustomXfermode.h"
9 #include "effects/GrCustomXfermodePriv.h" 9 #include "effects/GrCustomXfermodePriv.h"
10 10
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 545
546 private: 546 private:
547 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, 547 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
548 const GrProcOptInfo& coveragePO I, 548 const GrProcOptInfo& coveragePO I,
549 bool doesStencilWrite, 549 bool doesStencilWrite,
550 GrColor* overrideColor, 550 GrColor* overrideColor,
551 const GrCaps& caps) override; 551 const GrCaps& caps) override;
552 552
553 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override; 553 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override;
554 554
555 bool onWillNeedXferBarrier(const GrRenderTarget* rt, 555 GrXferBarrierType onXferBarrier(const GrRenderTarget*, const GrCaps&) const override;
556 const GrCaps& caps,
557 GrXferBarrierType* outBarrierType) const override ;
558 556
559 void onGetBlendInfo(BlendInfo*) const override; 557 void onGetBlendInfo(BlendInfo*) const override;
560 558
561 bool onIsEqual(const GrXferProcessor& xpBase) const override; 559 bool onIsEqual(const GrXferProcessor& xpBase) const override;
562 560
563 const SkXfermode::Mode fMode; 561 const SkXfermode::Mode fMode;
564 const GrBlendEquation fHWBlendEquation; 562 const GrBlendEquation fHWBlendEquation;
565 563
566 typedef GrXferProcessor INHERITED; 564 typedef GrXferProcessor INHERITED;
567 }; 565 };
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 OptFlags flags = kNone_OptFlags; 748 OptFlags flags = kNone_OptFlags;
751 if (colorPOI.allStagesMultiplyInput()) { 749 if (colorPOI.allStagesMultiplyInput()) {
752 flags |= kCanTweakAlphaForCoverage_OptFlag; 750 flags |= kCanTweakAlphaForCoverage_OptFlag;
753 } 751 }
754 if (this->hasHWBlendEquation() && coveragePOI.isSolidWhite()) { 752 if (this->hasHWBlendEquation() && coveragePOI.isSolidWhite()) {
755 flags |= kIgnoreCoverage_OptFlag; 753 flags |= kIgnoreCoverage_OptFlag;
756 } 754 }
757 return flags; 755 return flags;
758 } 756 }
759 757
760 bool CustomXP::onWillNeedXferBarrier(const GrRenderTarget* rt, 758 GrXferBarrierType CustomXP::onXferBarrier(const GrRenderTarget* rt, const GrCaps & caps) const {
761 const GrCaps& caps,
762 GrXferBarrierType* outBarrierType) const {
763 if (this->hasHWBlendEquation() && !caps.advancedCoherentBlendEquationSupport ()) { 759 if (this->hasHWBlendEquation() && !caps.advancedCoherentBlendEquationSupport ()) {
764 *outBarrierType = kBlend_GrXferBarrierType; 760 return kBlend_GrXferBarrierType;
765 return true;
766 } 761 }
767 return false; 762 return kNone_GrXferBarrierType;
768 } 763 }
769 764
770 void CustomXP::onGetBlendInfo(BlendInfo* blendInfo) const { 765 void CustomXP::onGetBlendInfo(BlendInfo* blendInfo) const {
771 if (this->hasHWBlendEquation()) { 766 if (this->hasHWBlendEquation()) {
772 blendInfo->fEquation = this->hwBlendEquation(); 767 blendInfo->fEquation = this->hwBlendEquation();
773 } 768 }
774 } 769 }
775 770
776 /////////////////////////////////////////////////////////////////////////////// 771 ///////////////////////////////////////////////////////////////////////////////
777 772
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 } 804 }
810 805
811 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); 806 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory);
812 GrXPFactory* GrCustomXPFactory::TestCreate(GrProcessorTestData* d) { 807 GrXPFactory* GrCustomXPFactory::TestCreate(GrProcessorTestData* d) {
813 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1, 808 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1,
814 SkXfermode::kLastSeparableMode); 809 SkXfermode::kLastSeparableMode);
815 810
816 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); 811 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode)));
817 } 812 }
818 813
OLDNEW
« no previous file with comments | « src/gpu/batches/GrTestBatch.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698