From e73f1f6dfa665802a942e743a227b5c98bc958db Mon Sep 17 00:00:00 2001 From: egdaniel Date: Tue, 22 Sep 2015 10:10:55 -0700 Subject: Prefer dual source/framebuffer fetch paths for GPU LCD. This will allow us to batch over color changes for LCD text. BUG=skia: Review URL: https://codereview.chromium.org/1354423002 --- src/gpu/effects/GrPorterDuffXferProcessor.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp index 1312d35335..e31ff653f3 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp +++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp @@ -731,7 +731,11 @@ GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps, BlendFormula blendFormula; if (covPOI.isFourChannelOutput()) { if (SkXfermode::kSrcOver_Mode == fXfermode && - kRGBA_GrColorComponentFlags == colorPOI.validFlags()) { + kRGBA_GrColorComponentFlags == colorPOI.validFlags() && + !caps.shaderCaps()->dualSourceBlendingSupport() && + !caps.shaderCaps()->dstReadInShaderSupport()) { + // If we don't have dual source blending or in shader dst reads, we fall back to this + // trick for rendering SrcOver LCD text instead of doing a dst copy. SkASSERT(!dstTexture || !dstTexture->texture()); return PDLCDXferProcessor::Create(fXfermode, colorPOI); } @@ -792,7 +796,8 @@ bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps, // the XP. if (covPOI.isFourChannelOutput()) { if (SkXfermode::kSrcOver_Mode == fXfermode && - kRGBA_GrColorComponentFlags == colorPOI.validFlags()) { + kRGBA_GrColorComponentFlags == colorPOI.validFlags() && + !caps.shaderCaps()->dstReadInShaderSupport()) { return false; } return get_lcd_blend_formula(covPOI, fXfermode).hasSecondaryOutput(); -- cgit v1.2.3