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 <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Chris Dalton 2019-12-28 14:51:11 -07:00 committed by Skia Commit-Bot
parent e1196c5d01
commit 37ae4b06e2
5 changed files with 37 additions and 41 deletions

View File

@ -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

View File

@ -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.
};
/**

View File

@ -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&);

View File

@ -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) {

View File

@ -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());
}
});