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

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

Issue 1541903002: added support for PLS path rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 12 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 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 return nullptr; 740 return nullptr;
741 } 741 }
742 return SkRef(gFactories[xfermode]); 742 return SkRef(gFactories[xfermode]);
743 } 743 }
744 744
745 GrXferProcessor* 745 GrXferProcessor*
746 GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps, 746 GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
747 const GrPipelineOptimizations& opti mizations, 747 const GrPipelineOptimizations& opti mizations,
748 bool hasMixedSamples, 748 bool hasMixedSamples,
749 const DstTexture* dstTexture) const { 749 const DstTexture* dstTexture) const {
750 if (optimizations.fOverrides.fUsePLSDstRead) {
bsalomon 2016/01/04 15:33:47 Maybe time to rename GrPipelineOptimizations... se
751 return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, fXfermode) ;
752 }
750 BlendFormula blendFormula; 753 BlendFormula blendFormula;
751 if (optimizations.fCoveragePOI.isFourChannelOutput()) { 754 if (optimizations.fCoveragePOI.isFourChannelOutput()) {
752 if (SkXfermode::kSrcOver_Mode == fXfermode && 755 if (SkXfermode::kSrcOver_Mode == fXfermode &&
753 kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() && 756 kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
754 !caps.shaderCaps()->dualSourceBlendingSupport() && 757 !caps.shaderCaps()->dualSourceBlendingSupport() &&
755 !caps.shaderCaps()->dstReadInShaderSupport()) { 758 !caps.shaderCaps()->dstReadInShaderSupport()) {
756 // If we don't have dual source blending or in shader dst reads, we fall back to this 759 // If we don't have dual source blending or in shader dst reads, we fall back to this
757 // trick for rendering SrcOver LCD text instead of doing a dst copy. 760 // trick for rendering SrcOver LCD text instead of doing a dst copy.
758 SkASSERT(!dstTexture || !dstTexture->texture()); 761 SkASSERT(!dstTexture || !dstTexture->texture());
759 return PDLCDXferProcessor::Create(fXfermode, optimizations.fColorPOI ); 762 return PDLCDXferProcessor::Create(fXfermode, optimizations.fColorPOI );
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 802
800 default: 803 default:
801 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; 804 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
802 return; 805 return;
803 } 806 }
804 } 807 }
805 808
806 bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps, 809 bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps,
807 const GrPipelineOptimizations& opti mizations, 810 const GrPipelineOptimizations& opti mizations,
808 bool hasMixedSamples) const { 811 bool hasMixedSamples) const {
812 if (optimizations.fOverrides.fUsePLSDstRead) {
813 return true;
814 }
809 if (caps.shaderCaps()->dualSourceBlendingSupport()) { 815 if (caps.shaderCaps()->dualSourceBlendingSupport()) {
810 return false; 816 return false;
811 } 817 }
812 818
813 // When we have four channel coverage we always need to read the dst in orde r to correctly 819 // When we have four channel coverage we always need to read the dst in orde r to correctly
814 // blend. The one exception is when we are using srcover mode and we know th e input color into 820 // blend. The one exception is when we are using srcover mode and we know th e input color into
815 // the XP. 821 // the XP.
816 if (optimizations.fCoveragePOI.isFourChannelOutput()) { 822 if (optimizations.fCoveragePOI.isFourChannelOutput()) {
817 if (SkXfermode::kSrcOver_Mode == fXfermode && 823 if (SkXfermode::kSrcOver_Mode == fXfermode &&
818 kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() && 824 kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
(...skipping 30 matching lines...) Expand all
849 855
850 //////////////////////////////////////////////////////////////////////////////// //////////////// 856 //////////////////////////////////////////////////////////////////////////////// ////////////////
851 // SrcOver Global functions 857 // SrcOver Global functions
852 //////////////////////////////////////////////////////////////////////////////// //////////////// 858 //////////////////////////////////////////////////////////////////////////////// ////////////////
853 859
854 GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor( 860 GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
855 const GrCaps& caps, 861 const GrCaps& caps,
856 const GrPipelineOptimizations& optimizations, 862 const GrPipelineOptimizations& optimizations,
857 bool hasMixedSamples, 863 bool hasMixedSamples,
858 const GrXferProcessor::DstTexture* dstTexture) { 864 const GrXferProcessor::DstTexture* dstTexture) {
865 if (optimizations.fOverrides.fUsePLSDstRead) {
866 return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, SkXfermode ::kSrcOver_Mode);
867 }
859 if (!optimizations.fCoveragePOI.isFourChannelOutput() && 868 if (!optimizations.fCoveragePOI.isFourChannelOutput() &&
860 !(optimizations.fCoveragePOI.isSolidWhite() && 869 !(optimizations.fCoveragePOI.isSolidWhite() &&
861 !hasMixedSamples && 870 !hasMixedSamples &&
862 optimizations.fColorPOI.isOpaque())) { 871 optimizations.fColorPOI.isOpaque())) {
863 static BlendFormula gSrcOverBlendFormula = COEFF_FORMULA(kOne_GrBlendCoe ff, 872 static BlendFormula gSrcOverBlendFormula = COEFF_FORMULA(kOne_GrBlendCoe ff,
864 kISA_GrBlendCoe ff); 873 kISA_GrBlendCoe ff);
865 static PorterDuffXferProcessor gSrcOverXP(gSrcOverBlendFormula); 874 static PorterDuffXferProcessor gSrcOverXP(gSrcOverBlendFormula);
866 SkASSERT(!dstTexture || !dstTexture->texture()); 875 SkASSERT(!dstTexture || !dstTexture->texture());
867 gSrcOverXP.ref(); 876 gSrcOverXP.ref();
868 return &gSrcOverXP; 877 return &gSrcOverXP;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 } 920 }
912 return get_lcd_blend_formula(optimizations.fCoveragePOI, 921 return get_lcd_blend_formula(optimizations.fCoveragePOI,
913 SkXfermode::kSrcOver_Mode).hasSecondaryOutp ut(); 922 SkXfermode::kSrcOver_Mode).hasSecondaryOutp ut();
914 } 923 }
915 // We fallback on the shader XP when the blend formula would use dual source blending but we 924 // We fallback on the shader XP when the blend formula would use dual source blending but we
916 // don't have support for it. 925 // don't have support for it.
917 return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI , 926 return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI ,
918 hasMixedSamples, SkXfermode::kSrcOver_Mode).hasSeco ndaryOutput(); 927 hasMixedSamples, SkXfermode::kSrcOver_Mode).hasSeco ndaryOutput();
919 } 928 }
920 929
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698