Commit c70b8f84 by Jonah Ryan-Davis Committed by Commit Bot

GL: Workaround NVIDIA issue in glLinkProgram

When TSAN is enabled, it catches some bad memory access in the NVIDIA driver on Linux during glLinkProgram with multithreaded linking. To workaround this, assume we don't have native support for KHR_parallel_shader_compile Bug: chromium:1094869 Change-Id: I92f042b39028df108de2c5378311cc0c7b683e08 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2250938Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
parent 84fb97ba
...@@ -458,6 +458,12 @@ struct FeaturesGL : FeatureSetBase ...@@ -458,6 +458,12 @@ struct FeaturesGL : FeatureSetBase
"disable_gpu_switching_support", FeatureCategory::OpenGLWorkarounds, "disable_gpu_switching_support", FeatureCategory::OpenGLWorkarounds,
"Disable GPU switching support (use only the low-power GPU) on older MacBook Pros.", "Disable GPU switching support (use only the low-power GPU) on older MacBook Pros.",
&members, "https://crbug.com/1091824"}; &members, "https://crbug.com/1091824"};
// KHR_parallel_shader_compile fails TSAN on Linux, so we avoid using it with this workaround.
Feature disableNativeParallelCompile = {
"disable_native_parallel_compile", FeatureCategory::OpenGLWorkarounds,
"Do not use native KHR_parallel_shader_compile even when available.", &members,
"http://crbug.com/1094869"};
}; };
inline FeaturesGL::FeaturesGL() = default; inline FeaturesGL::FeaturesGL() = default;
......
...@@ -445,6 +445,12 @@ unsigned int RendererGL::getMaxWorkerContexts() ...@@ -445,6 +445,12 @@ unsigned int RendererGL::getMaxWorkerContexts()
bool RendererGL::hasNativeParallelCompile() bool RendererGL::hasNativeParallelCompile()
{ {
#ifdef THREAD_SANITIZER
if (mFeatures.disableNativeParallelCompile)
{
return false;
}
#endif
return mFunctions->maxShaderCompilerThreadsKHR != nullptr || return mFunctions->maxShaderCompilerThreadsKHR != nullptr ||
mFunctions->maxShaderCompilerThreadsARB != nullptr; mFunctions->maxShaderCompilerThreadsARB != nullptr;
} }
......
...@@ -1775,6 +1775,10 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ...@@ -1775,6 +1775,10 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
} }
} }
ANGLE_FEATURE_CONDITION(features, disableGPUSwitchingSupport, isDualGPUMacWithNVIDIA); ANGLE_FEATURE_CONDITION(features, disableGPUSwitchingSupport, isDualGPUMacWithNVIDIA);
// Workaround issue in NVIDIA GL driver on Linux
// http://crbug.com/1094869
ANGLE_FEATURE_CONDITION(features, disableNativeParallelCompile, IsLinux() && isNvidia);
} }
void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features) void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features)
......
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