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>
This commit is contained in:
parent
45c57e116e
commit
4ac9aadd30
@ -36,7 +36,7 @@ static sk_sp<GrDirectContext> make_mock_context() {
|
||||
|
||||
GrContextOptions ctxOptions;
|
||||
ctxOptions.fGpuPathRenderers = GpuPathRenderers::kTessellation;
|
||||
ctxOptions.fSuppressTessellationShaders = false;
|
||||
ctxOptions.fEnableExperimentalHardwareTessellation = true;
|
||||
|
||||
return GrDirectContext::MakeMock(&mockOptions, ctxOptions);
|
||||
}
|
||||
|
@ -251,6 +251,11 @@ struct SK_API GrContextOptions {
|
||||
*/
|
||||
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.
|
||||
@ -266,11 +271,6 @@ struct SK_API GrContextOptions {
|
||||
*/
|
||||
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.
|
||||
|
@ -175,6 +175,9 @@ void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) {
|
||||
SkASSERT(!fMustWriteToFragColor);
|
||||
SkASSERT(!fNoDefaultPrecisionForExternalSamplers);
|
||||
}
|
||||
if (!options.fEnableExperimentalHardwareTessellation) {
|
||||
fMaxTessellationSegments = 0;
|
||||
}
|
||||
#if GR_TEST_UTILS
|
||||
if (options.fSuppressDualSourceBlending) {
|
||||
fDualSourceBlendingSupport = false;
|
||||
@ -182,15 +185,9 @@ void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) {
|
||||
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
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user