From 1a325d25b941ef801b3e9b2c0342da43cf35cdba Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Fri, 14 Jul 2017 15:17:41 -0600 Subject: Coverage counting path renderer Initial implementation of a GPU path renderer that draws antialiased paths by counting coverage in an offscreen buffer. Initially disabled until it has had time to soak. Bug: skia: Change-Id: I003d8cfdf8dc62641581b5ea2dc4f0aa00108df6 Reviewed-on: https://skia-review.googlesource.com/21541 Commit-Queue: Chris Dalton Reviewed-by: Greg Daniel Reviewed-by: Brian Salomon Reviewed-by: Robert Phillips --- tools/flags/SkCommonFlagsPathRenderer.h | 2 ++ tools/viewer/Viewer.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) (limited to 'tools') diff --git a/tools/flags/SkCommonFlagsPathRenderer.h b/tools/flags/SkCommonFlagsPathRenderer.h index 12755dcc06..ac293a1e79 100644 --- a/tools/flags/SkCommonFlagsPathRenderer.h +++ b/tools/flags/SkCommonFlagsPathRenderer.h @@ -40,6 +40,8 @@ inline GrContextOptions::GpuPathRenderers get_named_pathrenderers_flags(const ch return GpuPathRenderers::kAALinearizing; } else if (!strcmp(name, "small")) { return GpuPathRenderers::kSmall; + } else if (!strcmp(name, "ccpr")) { + return GpuPathRenderers::kCoverageCounting; } else if (!strcmp(name, "tess")) { return GpuPathRenderers::kTessellating; } else if (!strcmp(name, "grdefault")) { diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index 29e5b70cb8..6753b6b63e 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -37,6 +37,8 @@ #include "imgui.h" +#include "ccpr/GrCoverageCountingPathRenderer.h" + #include #include @@ -262,6 +264,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData) gPathRendererNames[GpuPathRenderers::kStencilAndCover] = "NV_path_rendering"; gPathRendererNames[GpuPathRenderers::kMSAA] = "Sample shading"; gPathRendererNames[GpuPathRenderers::kSmall] = "Small paths (cached sdf or alpha masks)"; + gPathRendererNames[GpuPathRenderers::kCoverageCounting] = "Coverage counting"; gPathRendererNames[GpuPathRenderers::kTessellating] = "Tessellating"; gPathRendererNames[GpuPathRenderers::kDefault] = "Original Ganesh path renderer"; gPathRendererNames[GpuPathRenderers::kNone] = "Software masks"; @@ -1069,6 +1072,9 @@ void Viewer::drawImGui(SkCanvas* canvas) { prButton(GpuPathRenderers::kNone); } else { prButton(GpuPathRenderers::kAll); + if (GrCoverageCountingPathRenderer::IsSupported(*ctx->caps())) { + prButton(GpuPathRenderers::kCoverageCounting); + } prButton(GpuPathRenderers::kSmall); prButton(GpuPathRenderers::kTessellating); prButton(GpuPathRenderers::kNone); @@ -1305,6 +1311,9 @@ void Viewer::updateUIState() { prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kNone]); } else { prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kAll]); + if (GrCoverageCountingPathRenderer::IsSupported(*ctx->caps())) { + prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kCoverageCounting]); + } prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kSmall]); prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kTessellating]); prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kNone]); -- cgit v1.2.3