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

Unified Diff: src/gpu/effects/GrPorterDuffXferProcessor.cpp

Issue 2259113002: Relax check for gpu use of static src-over XP (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nits Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrPorterDuffXferProcessor.cpp
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 9aae0262be3658b3bc3eab7250a557237d10f067..7f804bb60fbad4d4e87ee76a4e276995253eddc4 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -862,10 +862,12 @@ GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
if (optimizations.fOverrides.fUsePLSDstRead) {
return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, SkXfermode::kSrcOver_Mode);
}
- if (!optimizations.fCoveragePOI.isFourChannelOutput() &&
- !(optimizations.fCoveragePOI.isSolidWhite() &&
- !hasMixedSamples &&
- optimizations.fColorPOI.isOpaque())) {
+
+ // We want to not make an xfer processor if possible. Thus for the simple case where we are not
+ // doing lcd blending we will just use our global SimpleSrcOverXP. This slightly differs from
+ // the general case where we convert a src-over blend that has solid coverage and an opaque
+ // color to src-mode, which allows disabling of blending.
+ if (!optimizations.fCoveragePOI.isFourChannelOutput()) {
// We return nullptr here, which our caller interprets as meaning "use SimpleSrcOverXP".
// We don't simply return the address of that XP here because our caller would have to unref
// it and since it is a global object and GrProgramElement's ref-cnting system is not thread
@@ -873,23 +875,18 @@ GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
return nullptr;
}
- BlendFormula blendFormula;
- if (optimizations.fCoveragePOI.isFourChannelOutput()) {
- if (kRGBA_GrColorComponentFlags == optimizations.fColorPOI.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(SkXfermode::kSrcOver_Mode, optimizations.fColorPOI);
- }
- blendFormula = get_lcd_blend_formula(optimizations.fCoveragePOI, SkXfermode::kSrcOver_Mode);
- } else {
- blendFormula = get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI,
- hasMixedSamples, SkXfermode::kSrcOver_Mode);
+ if (kRGBA_GrColorComponentFlags == optimizations.fColorPOI.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(SkXfermode::kSrcOver_Mode, optimizations.fColorPOI);
}
+ BlendFormula blendFormula;
+ blendFormula = get_lcd_blend_formula(optimizations.fCoveragePOI, SkXfermode::kSrcOver_Mode);
if (blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) {
return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, SkXfermode::kSrcOver_Mode);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698