Commit 0303cf6b by Jiawei Shao Committed by Commit Bot

OpenGL: Port all Intel-related workaround conditions from gpu_driver_bug_list.json

This patch ports all the Intel-related shader workarounds defined in gpu_driver_bug_list.json used by Chromium validating command buffer into ANGLE so that they can also take effect in Chromium passthrough command buffer. Bug: 1020467 Bug: 642605 Bug: 403957 Change-Id: I8e4866fc34d5e8f1b2f4dbfa8e526b80249ba166 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1889386 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent b066177a
......@@ -55,7 +55,8 @@ struct FeaturesGL : FeatureSetBase
// Work around this by rewriting the do-while to use another GLSL construct (block + while)
Feature doWhileGLSLCausesGPUHang = {
"do_while_glsl_causes_gpu_hang", FeatureCategory::OpenGLWorkarounds,
"Some GLSL constructs involving do-while loops cause GPU hangs", &members};
"Some GLSL constructs involving do-while loops cause GPU hangs", &members,
"http://crbug.com/644669"};
// On Mac AMD GPU gl_VertexID in GLSL vertex shader doesn't include base vertex value,
// Work aronud this by replace gl_VertexID with (gl_VertexID - angle_BaseVertex) when
......@@ -104,7 +105,7 @@ struct FeaturesGL : FeatureSetBase
// Emulate abs(i) with i * sign(i).
Feature emulateAbsIntFunction = {"emulate_abs_int_function", FeatureCategory::OpenGLWorkarounds,
"abs(i) where i is an integer returns unexpected result",
&members};
&members, "http://crbug.com/642227"};
// On Intel Mac, calculation of loop conditions in for and while loop has bug.
// Add "&& true" to the end of the condition expression to work around the bug.
......@@ -212,7 +213,8 @@ struct FeaturesGL : FeatureSetBase
// On some Android devices for loops used to initialize variables hit native GLSL compiler bugs.
Feature dontUseLoopsToInitializeVariables = {
"dont_use_loops_to_initialize_variables", FeatureCategory::OpenGLWorkarounds,
"For loops used to initialize variables hit native GLSL compiler bugs", &members};
"For loops used to initialize variables hit native GLSL compiler bugs", &members,
"http://crbug.com/809422"};
// On some NVIDIA drivers gl_FragDepth is not clamped correctly when rendering to a floating
// point depth buffer. Clamp it in the translated shader to fix this.
......@@ -367,6 +369,23 @@ struct FeaturesGL : FeatureSetBase
"remove_dynamic_indexing_of_swizzled_vector", FeatureCategory::OpenGLWorkarounds,
"Dynamic indexing of swizzled l-values doesn't work correctly on various platforms.",
&members, "http://crbug.com/709351"};
// Intel Mac drivers does not treat texelFetchOffset() correctly.
Feature preAddTexelFetchOffsets = {
"pre_add_texel_fetch_offsets", FeatureCategory::OpenGLWorkarounds,
"Intel Mac drivers mistakenly consider the parameter position of nagative vaule as invalid "
"even if the sum of position and offset is in range, so we need to add workarounds by "
"rewriting texelFetchOffset(sampler, position, lod, offset) into texelFetch(sampler, "
"position + offset, lod).",
&members, "http://crbug.com/642605"};
// All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct
// name with a unique prefix
Feature regenerateStructNames = {
"regenerate_struct_names", FeatureCategory::OpenGLWorkarounds,
"All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct"
"name with a unique prefix.",
&members, "http://crbug.com/403957"};
};
inline FeaturesGL::FeaturesGL() = default;
......
......@@ -348,6 +348,16 @@ std::shared_ptr<WaitableCompileEvent> ShaderGL::compile(const gl::Context *conte
additionalOptions |= SH_REMOVE_DYNAMIC_INDEXING_OF_SWIZZLED_VECTOR;
}
if (features.preAddTexelFetchOffsets.enabled)
{
additionalOptions |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH;
}
if (features.regenerateStructNames.enabled)
{
additionalOptions |= SH_REGENERATE_STRUCT_NAMES;
}
options |= additionalOptions;
auto workerThreadPool = context->getWorkerThreadPool();
......
......@@ -1470,11 +1470,15 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
ANGLE_FEATURE_CONDITION(features, rgba4IsNotSupportedForColorRendering,
functions->standard == STANDARD_GL_DESKTOP && isIntel);
ANGLE_FEATURE_CONDITION(features, emulateAbsIntFunction, isIntel);
// Ported from gpu_driver_bug_list.json (#183)
ANGLE_FEATURE_CONDITION(features, emulateAbsIntFunction, IsApple() && isIntel);
ANGLE_FEATURE_CONDITION(features, addAndTrueToLoopCondition, IsApple() && isIntel);
ANGLE_FEATURE_CONDITION(features, emulateIsnanFloat, isIntel);
// Ported from gpu_driver_bug_list.json (#191)
ANGLE_FEATURE_CONDITION(
features, emulateIsnanFloat,
isIntel && IsApple() && IsSkylake(device) && GetMacOSVersion() < OSVersion(10, 13, 2));
ANGLE_FEATURE_CONDITION(features, doesSRGBClearsOnLinearFramebufferAttachments,
functions->standard == STANDARD_GL_DESKTOP && (isIntel || isAMD));
......@@ -1485,8 +1489,14 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
features, useUnusedBlocksWithStandardOrSharedLayout,
(IsApple() && functions->standard == STANDARD_GL_DESKTOP) || (IsLinux() && isAMD));
ANGLE_FEATURE_CONDITION(features, doWhileGLSLCausesGPUHang, IsApple());
ANGLE_FEATURE_CONDITION(features, rewriteFloatUnaryMinusOperator, IsApple() && isIntel);
// Ported from gpu_driver_bug_list.json (#187)
ANGLE_FEATURE_CONDITION(features, doWhileGLSLCausesGPUHang,
IsApple() && functions->standard == STANDARD_GL_DESKTOP &&
GetMacOSVersion() < OSVersion(10, 11, 0));
// Ported from gpu_driver_bug_list.json (#211)
ANGLE_FEATURE_CONDITION(features, rewriteFloatUnaryMinusOperator,
IsApple() && isIntel && GetMacOSVersion() < OSVersion(10, 12, 0));
ANGLE_FEATURE_CONDITION(features, addBaseVertexToVertexID, IsApple() && isAMD);
......@@ -1535,7 +1545,9 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
ANGLE_FEATURE_CONDITION(features, clampPointSize, IsAndroid() || isNvidia);
ANGLE_FEATURE_CONDITION(features, dontUseLoopsToInitializeVariables, IsAndroid() && !isNvidia);
// Ported from gpu_driver_bug_list.json (#246, #258)
ANGLE_FEATURE_CONDITION(features, dontUseLoopsToInitializeVariables,
(IsAndroid() && !isNvidia) || (isIntel && IsApple()));
ANGLE_FEATURE_CONDITION(features, disableBlendFuncExtended, isAMD || isIntel);
......@@ -1584,6 +1596,13 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
ANGLE_FEATURE_CONDITION(features, removeDynamicIndexingOfSwizzledVector,
IsApple() || IsAndroid() || IsWindows());
// Ported from gpu_driver_bug_list.json (#89)
ANGLE_FEATURE_CONDITION(features, regenerateStructNames,
IsApple() && functions->standard == STANDARD_GL_DESKTOP);
// Ported from gpu_driver_bug_list.json (#184)
ANGLE_FEATURE_CONDITION(features, preAddTexelFetchOffsets, IsApple() && isIntel);
}
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