Make it possible to enable hw tessellation outside of test builds
Bug: chromium:1172543
Change-Id: I9733a8758d902a8d46d442de5d099d923efc2184
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375376
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/bench/TessellateBench.cpp b/bench/TessellateBench.cpp
index c0cb7dd..e4a6201 100644
--- a/bench/TessellateBench.cpp
+++ b/bench/TessellateBench.cpp
@@ -36,7 +36,7 @@
GrContextOptions ctxOptions;
ctxOptions.fGpuPathRenderers = GpuPathRenderers::kTessellation;
- ctxOptions.fSuppressTessellationShaders = false;
+ ctxOptions.fEnableExperimentalHardwareTessellation = true;
return GrDirectContext::MakeMock(&mockOptions, ctxOptions);
}
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 2d69558..c7b9aab 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -251,6 +251,11 @@
*/
bool fSuppressMipmapSupport = false;
+ /**
+ * If true, and if supported, enables hardware tessellation in the caps.
+ */
+ bool fEnableExperimentalHardwareTessellation = false;
+
#if GR_TEST_UTILS
/**
* Private options that are only meant for testing within Skia's tools.
@@ -267,11 +272,6 @@
bool fSuppressGeometryShaders = false;
/**
- * If true, the caps will never support tessellation shaders.
- */
- bool fSuppressTessellationShaders = true;
-
- /**
* If greater than zero and less than the actual hardware limit, overrides the maximum number of
* tessellation segments supported by the caps.
*/
diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp
index 2f9c33b..a1942e5 100644
--- a/src/gpu/GrShaderCaps.cpp
+++ b/src/gpu/GrShaderCaps.cpp
@@ -175,6 +175,9 @@
SkASSERT(!fMustWriteToFragColor);
SkASSERT(!fNoDefaultPrecisionForExternalSamplers);
}
+ if (!options.fEnableExperimentalHardwareTessellation) {
+ fMaxTessellationSegments = 0;
+ }
#if GR_TEST_UTILS
if (options.fSuppressDualSourceBlending) {
fDualSourceBlendingSupport = false;
@@ -182,15 +185,9 @@
if (options.fSuppressGeometryShaders) {
fGeometryShaderSupport = false;
}
- if (options.fSuppressTessellationShaders) {
- fMaxTessellationSegments = 0;
- }
if (options.fMaxTessellationSegmentsOverride > 0) {
fMaxTessellationSegments = std::min(options.fMaxTessellationSegmentsOverride,
fMaxTessellationSegments);
}
-#else
- // Tessellation shaders are still very experimental. Always disable them outside of test builds.
- fMaxTessellationSegments = 0;
#endif
}
diff --git a/tools/flags/CommonFlagsGpu.cpp b/tools/flags/CommonFlagsGpu.cpp
index 04b7540..2c39b83 100644
--- a/tools/flags/CommonFlagsGpu.cpp
+++ b/tools/flags/CommonFlagsGpu.cpp
@@ -98,7 +98,7 @@
ctxOptions->fAllowPathMaskCaching = FLAGS_cachePathMasks;
ctxOptions->fAllPathsVolatile = FLAGS_allPathsVolatile;
ctxOptions->fSuppressGeometryShaders = !FLAGS_gs;
- ctxOptions->fSuppressTessellationShaders = !FLAGS_hwtess;
+ ctxOptions->fEnableExperimentalHardwareTessellation = FLAGS_hwtess;
ctxOptions->fMaxTessellationSegmentsOverride = FLAGS_maxTessellationSegments;
ctxOptions->fGpuPathRenderers = collect_gpu_path_renderers_from_flags();
ctxOptions->fInternalMultisampleCount = FLAGS_internalSamples;