allow fallback to skvm blitter

This will let the threshold_rt GM draw even if --skvm isn't forced.
I don't see any GM diffs beyond that.

PS3 expands the same basic idea just a little wider.

Change-Id: I714c0fd2d4e6814c307a189a9f004e8ed729819a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297419
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
Mike Klein 2020-06-18 12:21:39 -05:00 committed by Skia Commit-Bot
parent c950e05baf
commit 92887b5474
2 changed files with 22 additions and 14 deletions

View File

@ -738,17 +738,29 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
SkMatrix ctm = matrixProvider.localToDevice();
if (gUseSkVMBlitter) {
if (auto blitter = SkCreateSkVMBlitter(device, *paint, ctm, alloc, clipShader)) {
if (auto blitter = SkCreateSkVMBlitter(device, *paint, ctm,
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 (auto blitter = SkCreateSkVMBlitter(device, *paint, ctm,
alloc, clipShader)) {
return blitter;
}
return alloc->make<SkNullBlitter>();
};
// We'll end here for many interesting cases: color spaces, color filters, most color types.
if (UseRasterPipelineBlitter(device, *paint, ctm) || clipShader) {
auto blitter =
SkCreateRasterPipelineBlitter(device, *paint, matrixProvider, alloc, clipShader);
SkASSERT(blitter);
return blitter;
return create_SkRP_or_SkVMBlitter();
}
// Everything but legacy kN32_SkColorType and kRGB_565_SkColorType should already be handled.
@ -765,12 +777,9 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
{*paint, ctm, nullptr, device.colorType(), device.colorSpace()},
alloc);
// Creating the context isn't always possible... we'll just fall back to raster pipeline.
// Creating the context isn't always possible... try fallbacks before giving up.
if (!shaderContext) {
auto blitter = SkCreateRasterPipelineBlitter(device, *paint, matrixProvider, alloc,
clipShader);
SkASSERT(blitter);
return blitter;
return create_SkRP_or_SkVMBlitter();
}
}
@ -790,8 +799,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
if (shaderContext && SkRGB565_Shader_Blitter::Supports(device, *paint)) {
return alloc->make<SkRGB565_Shader_Blitter>(device, *paint, shaderContext);
} else {
return SkCreateRasterPipelineBlitter(device, *paint, matrixProvider, alloc,
clipShader);
return create_SkRP_or_SkVMBlitter();
}
default:

View File

@ -123,8 +123,8 @@ SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
std::move(clipShader));
}
// The shader has opted out of drawing anything.
return alloc->make<SkNullBlitter>();
// The shader can't draw with SkRasterPipeline.
return nullptr;
}
SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,