From 37ae4b06e2dc6bafe81cd9ca1de5d28498a47c39 Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Sat, 28 Dec 2019 14:51:11 -0700 Subject: [PATCH] Rename GpuPathRenderers::kAll to kDefault There was never a need to distinguish between "all" and "default". We can just use kDefalut everywhere. And as we add new path renderers, we can exclude them from kDefault until they are ready to ship. Change-Id: I378aa1e195d40daef6a2c54f9c8e829208780ebe Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261714 Commit-Queue: Chris Dalton Reviewed-by: Brian Osman Reviewed-by: Brian Salomon --- include/gpu/GrContextOptions.h | 2 +- include/private/GrTypesPriv.h | 23 ++++++++---------- src/gpu/GrPathRendererChain.h | 2 +- tools/flags/CommonFlagsGpu.cpp | 8 +++---- tools/viewer/Viewer.cpp | 43 +++++++++++++++++----------------- 5 files changed, 37 insertions(+), 41 deletions(-) diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h index 6d1d6ca841..a9c16eaa11 100644 --- a/include/gpu/GrContextOptions.h +++ b/include/gpu/GrContextOptions.h @@ -248,7 +248,7 @@ struct SK_API GrContextOptions { /** * Include or exclude specific GPU path renderers. */ - GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kAll; + GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kDefault; #endif #if SK_SUPPORT_ATLAS_TEXT diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h index 4cd5b2acf8..0e9a728d91 100644 --- a/include/private/GrTypesPriv.h +++ b/include/private/GrTypesPriv.h @@ -783,19 +783,16 @@ typedef uint64_t GrFence; * Used to include or exclude specific GPU path renderers for testing purposes. */ enum class GpuPathRenderers { - kNone = 0, // Always use software masks and/or GrDefaultPathRenderer. - kDashLine = 1 << 0, - kStencilAndCover = 1 << 1, - kCoverageCounting = 1 << 2, - kAAHairline = 1 << 3, - kAAConvex = 1 << 4, - kAALinearizing = 1 << 5, - kSmall = 1 << 6, - kTessellating = 1 << 7, - - kAll = (kTessellating | (kTessellating - 1)), - kDefault = kAll & ~kCoverageCounting - + kNone = 0, // Always use software masks and/or GrDefaultPathRenderer. + kDashLine = 1 << 0, + kStencilAndCover = 1 << 1, + kCoverageCounting = 1 << 2, + kAAHairline = 1 << 3, + kAAConvex = 1 << 4, + kAALinearizing = 1 << 5, + kSmall = 1 << 6, + kTessellating = 1 << 7, + kDefault = (1 << 8) - 1 // All. }; /** diff --git a/src/gpu/GrPathRendererChain.h b/src/gpu/GrPathRendererChain.h index 3bd955c726..55e3ad8125 100644 --- a/src/gpu/GrPathRendererChain.h +++ b/src/gpu/GrPathRendererChain.h @@ -28,7 +28,7 @@ class GrPathRendererChain : public SkNoncopyable { public: struct Options { bool fAllowPathMaskCaching = false; - GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kAll; + GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kDefault; }; GrPathRendererChain(GrRecordingContext* context, const Options&); diff --git a/tools/flags/CommonFlagsGpu.cpp b/tools/flags/CommonFlagsGpu.cpp index 69639cecff..ea19aa91b7 100644 --- a/tools/flags/CommonFlagsGpu.cpp +++ b/tools/flags/CommonFlagsGpu.cpp @@ -54,19 +54,19 @@ static GpuPathRenderers get_named_pathrenderers_flags(const char* name) { return GpuPathRenderers::kSmall; } else if (!strcmp(name, "tess")) { return GpuPathRenderers::kTessellating; - } else if (!strcmp(name, "all")) { - return GpuPathRenderers::kAll; + } else if (!strcmp(name, "default")) { + return GpuPathRenderers::kDefault; } SK_ABORT(SkStringPrintf("error: unknown named path renderer \"%s\"\n", name).c_str()); } static GpuPathRenderers collect_gpu_path_renderers_from_flags() { if (FLAGS_pr.isEmpty()) { - return GpuPathRenderers::kAll; + return GpuPathRenderers::kDefault; } GpuPathRenderers gpuPathRenderers = ('~' == FLAGS_pr[0][0]) - ? GpuPathRenderers::kAll + ? GpuPathRenderers::kDefault : GpuPathRenderers::kNone; for (int i = 0; i < FLAGS_pr.count(); ++i) { diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index feaab156be..fcab247547 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -275,7 +275,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData) { SkGraphics::Init(); - gPathRendererNames[GpuPathRenderers::kAll] = "All Path Renderers"; + gPathRendererNames[GpuPathRenderers::kDefault] = "Default Path Renderers"; gPathRendererNames[GpuPathRenderers::kStencilAndCover] = "NV_path_rendering"; gPathRendererNames[GpuPathRenderers::kSmall] = "Small paths (cached sdf or alpha masks)"; gPathRendererNames[GpuPathRenderers::kCoverageCounting] = "CCPR"; @@ -951,7 +951,7 @@ void Viewer::updateTitle() { title.append("]"); GpuPathRenderers pr = fWindow->getRequestedDisplayParams().fGrContextOptions.fGpuPathRenderers; - if (GpuPathRenderers::kAll != pr) { + if (GpuPathRenderers::kDefault != pr) { title.appendf(" [Path renderer: %s]", gPathRendererNames[pr].c_str()); } @@ -1704,20 +1704,20 @@ void Viewer::drawImGui() { if (!ctx) { ImGui::RadioButton("Software", true); - } else if (fWindow->sampleCount() > 1) { - prButton(GpuPathRenderers::kAll); - if (ctx->priv().caps()->shaderCaps()->pathRenderingSupport()) { - prButton(GpuPathRenderers::kStencilAndCover); - } - prButton(GpuPathRenderers::kTessellating); - prButton(GpuPathRenderers::kNone); } else { - prButton(GpuPathRenderers::kAll); - if (GrCoverageCountingPathRenderer::IsSupported( - *ctx->priv().caps())) { - prButton(GpuPathRenderers::kCoverageCounting); + const auto* caps = ctx->priv().caps(); + prButton(GpuPathRenderers::kDefault); + if (fWindow->sampleCount() > 1 || caps->mixedSamplesSupport()) { + if (caps->shaderCaps()->pathRenderingSupport()) { + prButton(GpuPathRenderers::kStencilAndCover); + } + } + if (1 == fWindow->sampleCount()) { + if (GrCoverageCountingPathRenderer::IsSupported(*caps)) { + prButton(GpuPathRenderers::kCoverageCounting); + } + prButton(GpuPathRenderers::kSmall); } - prButton(GpuPathRenderers::kSmall); prButton(GpuPathRenderers::kTessellating); prButton(GpuPathRenderers::kNone); } @@ -2369,23 +2369,22 @@ void Viewer::updateUIState() { writer.appendString("Software"); } else { const auto* caps = ctx->priv().caps(); - - writer.appendString(gPathRendererNames[GpuPathRenderers::kAll].c_str()); - if (fWindow->sampleCount() > 1) { + writer.appendString(gPathRendererNames[GpuPathRenderers::kDefault].c_str()); + if (fWindow->sampleCount() > 1 || caps->mixedSamplesSupport()) { if (caps->shaderCaps()->pathRenderingSupport()) { writer.appendString( - gPathRendererNames[GpuPathRenderers::kStencilAndCover].c_str()); + gPathRendererNames[GpuPathRenderers::kStencilAndCover].c_str()); } - } else { + } + if (1 == fWindow->sampleCount()) { if(GrCoverageCountingPathRenderer::IsSupported(*caps)) { writer.appendString( gPathRendererNames[GpuPathRenderers::kCoverageCounting].c_str()); } writer.appendString(gPathRendererNames[GpuPathRenderers::kSmall].c_str()); } - writer.appendString( - gPathRendererNames[GpuPathRenderers::kTessellating].c_str()); - writer.appendString(gPathRendererNames[GpuPathRenderers::kNone].c_str()); + writer.appendString(gPathRendererNames[GpuPathRenderers::kTessellating].c_str()); + writer.appendString(gPathRendererNames[GpuPathRenderers::kNone].c_str()); } });