Commit e249239c by Charlie Lao Committed by Commit Bot

Vulkan: Add featue flag to force highp to mediump in fragment shader.

Adding feature flag that forces highp in fragment shader to mediump. It is disabled by default. You can enable it for experiment. Bug: b/184850002 Change-Id: I73980be4ad160eb1b17a3a3ecfc09f2e4aeb468c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2815240Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
parent 085044d1
......@@ -496,6 +496,13 @@ struct FeaturesVk : FeatureSetBase
// http://anglebug.com/3529
Feature enableBufferAge = {"enableBufferAge", FeatureCategory::VulkanWorkarounds,
"Expose EGL_EXT_buffer_age", &members, "http://anglebug.com/3529"};
// Whether we should force any highp precision in the fragment shader to mediump.
// ANGLE is non-conformant if this feature is enabled.
Feature forceFragmentShaderPrecisionHighpToMediump = {
"forceFragmentShaderPrecisionHighpToMediump", FeatureCategory::VulkanWorkarounds,
"Forces highp precision in fragment shader to mediump.", &members,
"https://issuetracker.google.com/184850002"};
};
inline FeaturesVk::FeaturesVk() = default;
......
......@@ -2366,6 +2366,10 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
// http://anglebug.com/3529
ANGLE_FEATURE_CONDITION(&mFeatures, enableBufferAge, !isSwiftShader);
// Disabled by default. Only enable it for experimental purpose, as this will cause various
// tests to fail.
ANGLE_FEATURE_CONDITION(&mFeatures, forceFragmentShaderPrecisionHighpToMediump, false);
angle::PlatformMethods *platform = ANGLEPlatformCurrent();
platform->overrideFeaturesVk(platform, &mFeatures);
......
......@@ -63,6 +63,11 @@ std::shared_ptr<WaitableCompileEvent> ShaderVk::compile(const gl::Context *conte
compileOptions |= SH_IGNORE_PRECISION_QUALIFIERS;
}
if (contextVk->getFeatures().forceFragmentShaderPrecisionHighpToMediump.enabled)
{
compileOptions |= SH_FORCE_SHADER_PRECISION_HIGHP_TO_MEDIUMP;
}
// Let compiler detect and emit early fragment test execution mode. We will remove it if
// context state does not allow it
compileOptions |= SH_EARLY_FRAGMENT_TESTS_OPTIMIZATION;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment