From 7b5b00aaf198be831299512c6cd504fe59f9aa1a Mon Sep 17 00:00:00 2001 From: Julia Lavrova Date: Wed, 16 Feb 2022 10:19:57 -0500 Subject: [PATCH] Fixing some inconsistencies in blitter selection. So --skvm and --forceRasterPipeline flags work more correctly. Change-Id: Ia1c3560a61dda4800785b1e7ad1a0e41fe42594d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509719 Reviewed-by: Brian Osman Commit-Queue: Julia Lavrova --- src/core/SkBlitter.cpp | 17 ++++++----------- src/core/SkBlitter_Sprite.cpp | 5 ++++- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp index 24ea34a621..f68f8eea9b 100644 --- a/src/core/SkBlitter.cpp +++ b/src/core/SkBlitter.cpp @@ -632,7 +632,7 @@ SkBlitter* SkBlitterClipper::apply(SkBlitter* blitter, const SkRegion* clip, bool SkBlitter::UseLegacyBlitter(const SkPixmap& device, const SkPaint& paint, const SkMatrix& matrix) { - if (gSkForceRasterPipelineBlitter) { + if (gSkForceRasterPipelineBlitter || gUseSkVMBlitter) { return false; } #if defined(SK_FORCE_RASTER_PIPELINE_BLITTER) @@ -734,19 +734,14 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device, paint.writable()->setDither(false); } - if (gUseSkVMBlitter) { - if (auto blitter = SkVMBlitter::Make(device, *paint, matrixProvider, - alloc, clipShader)) { - return blitter; - } - } - // Same basic idea used a few times: try SkRP, then try SkVM, then give up with a null-blitter. // (Setting gUseSkVMBlitter is the only way we prefer SkVM over SkRP at the moment.) auto create_SkRP_or_SkVMBlitter = [&]() -> SkBlitter* { - if (auto blitter = SkCreateRasterPipelineBlitter(device, *paint, matrixProvider, - alloc, clipShader)) { - return blitter; + if (!gUseSkVMBlitter) { + if (auto blitter = SkCreateRasterPipelineBlitter( + device, *paint, matrixProvider, alloc, clipShader)) { + return blitter; + } } if (auto blitter = SkVMBlitter::Make(device, *paint, matrixProvider, alloc, clipShader)) { diff --git a/src/core/SkBlitter_Sprite.cpp b/src/core/SkBlitter_Sprite.cpp index c0b0c6b35e..ecb23d416a 100644 --- a/src/core/SkBlitter_Sprite.cpp +++ b/src/core/SkBlitter_Sprite.cpp @@ -17,6 +17,7 @@ #include "src/core/SkVMBlitter.h" extern bool gUseSkVMBlitter; +extern bool gSkForceRasterPipelineBlitter; SkSpriteBlitter::SkSpriteBlitter(const SkPixmap& source) : fSource(source) {} @@ -199,7 +200,9 @@ SkBlitter* SkBlitter::ChooseSprite(const SkPixmap& dst, const SkPaint& paint, SkSpriteBlitter* blitter = nullptr; - if (0 == SkColorSpaceXformSteps(source,dst).flags.mask() && !clipShader) { + if (gSkForceRasterPipelineBlitter) { + // Do not use any of these optimized memory blitters + } else if (0 == SkColorSpaceXformSteps(source,dst).flags.mask() && !clipShader) { if (!blitter && SkSpriteBlitter_Memcpy::Supports(dst, source, paint)) { blitter = alloc->make(source); }