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

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: fix for ASAN failure Created 4 years, 10 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/GrDisableColorXP.cpp ('k') | src/gpu/gl/GrGLCaps.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 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 return nullptr; 732 return nullptr;
733 } 733 }
734 return SkRef(gFactories[xfermode]); 734 return SkRef(gFactories[xfermode]);
735 } 735 }
736 736
737 GrXferProcessor* 737 GrXferProcessor*
738 GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps, 738 GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
739 const GrPipelineOptimizations& opti mizations, 739 const GrPipelineOptimizations& opti mizations,
740 bool hasMixedSamples, 740 bool hasMixedSamples,
741 const DstTexture* dstTexture) const { 741 const DstTexture* dstTexture) const {
742 if (optimizations.fOverrides.fUsePLSDstRead) {
743 return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, fXfermode) ;
744 }
742 BlendFormula blendFormula; 745 BlendFormula blendFormula;
743 if (optimizations.fCoveragePOI.isFourChannelOutput()) { 746 if (optimizations.fCoveragePOI.isFourChannelOutput()) {
744 if (SkXfermode::kSrcOver_Mode == fXfermode && 747 if (SkXfermode::kSrcOver_Mode == fXfermode &&
745 kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() && 748 kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
746 !caps.shaderCaps()->dualSourceBlendingSupport() && 749 !caps.shaderCaps()->dualSourceBlendingSupport() &&
747 !caps.shaderCaps()->dstReadInShaderSupport()) { 750 !caps.shaderCaps()->dstReadInShaderSupport()) {
748 // If we don't have dual source blending or in shader dst reads, we fall back to this 751 // If we don't have dual source blending or in shader dst reads, we fall back to this
749 // trick for rendering SrcOver LCD text instead of doing a dst copy. 752 // trick for rendering SrcOver LCD text instead of doing a dst copy.
750 SkASSERT(!dstTexture || !dstTexture->texture()); 753 SkASSERT(!dstTexture || !dstTexture->texture());
751 return PDLCDXferProcessor::Create(fXfermode, optimizations.fColorPOI ); 754 return PDLCDXferProcessor::Create(fXfermode, optimizations.fColorPOI );
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 blendedColor->fKnownColor = colorPOI.color(); 791 blendedColor->fKnownColor = colorPOI.color();
789 blendedColor->fKnownColorFlags = colorPOI.validFlags(); 792 blendedColor->fKnownColorFlags = colorPOI.validFlags();
790 return; 793 return;
791 794
792 default: 795 default:
793 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; 796 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
794 return; 797 return;
795 } 798 }
796 } 799 }
797 800
798 bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps, 801 bool GrPorterDuffXPFactory::onWillReadDstColor(const GrCaps& caps,
799 const GrPipelineOptimizations& opti mizations, 802 const GrPipelineOptimizations& op timizations,
800 bool hasMixedSamples) const { 803 bool hasMixedSamples) const {
801 if (caps.shaderCaps()->dualSourceBlendingSupport()) { 804 if (caps.shaderCaps()->dualSourceBlendingSupport()) {
802 return false; 805 return false;
803 } 806 }
804 807
805 // When we have four channel coverage we always need to read the dst in orde r to correctly 808 // When we have four channel coverage we always need to read the dst in orde r to correctly
806 // blend. The one exception is when we are using srcover mode and we know th e input color into 809 // blend. The one exception is when we are using srcover mode and we know th e input color into
807 // the XP. 810 // the XP.
808 if (optimizations.fCoveragePOI.isFourChannelOutput()) { 811 if (optimizations.fCoveragePOI.isFourChannelOutput()) {
809 if (SkXfermode::kSrcOver_Mode == fXfermode && 812 if (SkXfermode::kSrcOver_Mode == fXfermode &&
810 kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() && 813 kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 kISA_GrBlendCoeff); 850 kISA_GrBlendCoeff);
848 static PorterDuffXferProcessor gSrcOverXP(gSrcOverBlendFormula); 851 static PorterDuffXferProcessor gSrcOverXP(gSrcOverBlendFormula);
849 return gSrcOverXP; 852 return gSrcOverXP;
850 } 853 }
851 854
852 GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor( 855 GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
853 const GrCaps& caps, 856 const GrCaps& caps,
854 const GrPipelineOptimizations& optimizations, 857 const GrPipelineOptimizations& optimizations,
855 bool hasMixedSamples, 858 bool hasMixedSamples,
856 const GrXferProcessor::DstTexture* dstTexture) { 859 const GrXferProcessor::DstTexture* dstTexture) {
860 if (optimizations.fOverrides.fUsePLSDstRead) {
861 return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, SkXfermode ::kSrcOver_Mode);
862 }
857 if (!optimizations.fCoveragePOI.isFourChannelOutput() && 863 if (!optimizations.fCoveragePOI.isFourChannelOutput() &&
858 !(optimizations.fCoveragePOI.isSolidWhite() && 864 !(optimizations.fCoveragePOI.isSolidWhite() &&
859 !hasMixedSamples && 865 !hasMixedSamples &&
860 optimizations.fColorPOI.isOpaque())) { 866 optimizations.fColorPOI.isOpaque())) {
861 // We return nullptr here, which our caller interprets as meaning "use S impleSrcOverXP". 867 // We return nullptr here, which our caller interprets as meaning "use S impleSrcOverXP".
862 // We don't simply return the address of that XP here because our caller would have to unref 868 // We don't simply return the address of that XP here because our caller would have to unref
863 // it and since it is a global object and GrProgramElement's ref-cnting system is not thread 869 // it and since it is a global object and GrProgramElement's ref-cnting system is not thread
864 // safe. 870 // safe.
865 return nullptr; 871 return nullptr;
866 } 872 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 } 914 }
909 return get_lcd_blend_formula(optimizations.fCoveragePOI, 915 return get_lcd_blend_formula(optimizations.fCoveragePOI,
910 SkXfermode::kSrcOver_Mode).hasSecondaryOutp ut(); 916 SkXfermode::kSrcOver_Mode).hasSecondaryOutp ut();
911 } 917 }
912 // We fallback on the shader XP when the blend formula would use dual source blending but we 918 // We fallback on the shader XP when the blend formula would use dual source blending but we
913 // don't have support for it. 919 // don't have support for it.
914 return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI , 920 return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI ,
915 hasMixedSamples, SkXfermode::kSrcOver_Mode).hasSeco ndaryOutput(); 921 hasMixedSamples, SkXfermode::kSrcOver_Mode).hasSeco ndaryOutput();
916 } 922 }
917 923
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.cpp ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698