SH_CLAMP_INDIRECT_ARRAY_BOUNDS logic update

Remain the old hardware requirement for turning on clampArrayAccess. But
also turns it on universally for WebGL context. So that we won't suffer
from clampArrayAccess not handled properly on some compute shader deqp
tests.

Bug: chromium:1042252, angleproject:4361
Change-Id: Ib11affd6df27ce7d2100980d2b8decdee36876e8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2026029
Reviewed-by: James Darpinian <jdarpinian@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
This commit is contained in:
shrekshao 2020-01-28 14:18:40 -08:00 коммит произвёл Commit Bot
Родитель b91acdcfea
Коммит eca11cc81c
4 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -128,6 +128,7 @@ const ShCompileOptions SH_ENFORCE_PACKING_RESTRICTIONS = UINT64_C(1) << 9;
// vec234, or mat234 type. The ShArrayIndexClampingStrategy enum, // vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
// specified in the ShBuiltInResources when constructing the // specified in the ShBuiltInResources when constructing the
// compiler, selects the strategy for the clamping implementation. // compiler, selects the strategy for the clamping implementation.
// TODO(http://anglebug.com/4361): fix for compute shaders.
const ShCompileOptions SH_CLAMP_INDIRECT_ARRAY_BOUNDS = UINT64_C(1) << 10; const ShCompileOptions SH_CLAMP_INDIRECT_ARRAY_BOUNDS = UINT64_C(1) << 10;
// This flag limits the complexity of an expression. // This flag limits the complexity of an expression.

Просмотреть файл

@ -617,7 +617,7 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
} }
// Clamping uniform array bounds needs to happen after validateLimitations pass. // Clamping uniform array bounds needs to happen after validateLimitations pass.
if (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS && mShaderType != GL_COMPUTE_SHADER) if (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS)
{ {
mArrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root); mArrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
} }

Просмотреть файл

@ -333,7 +333,7 @@ std::shared_ptr<WaitableCompileEvent> ShaderGL::compile(const gl::Context *conte
additionalOptions |= SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER; additionalOptions |= SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER;
} }
if (features.clampArrayAccess.enabled) if (features.clampArrayAccess.enabled || isWebGL)
{ {
additionalOptions |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS; additionalOptions |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS;
} }

Просмотреть файл

@ -1601,7 +1601,9 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
// on AMD and Android devices. // on AMD and Android devices.
// This test is also flaky on Linux Nvidia. So we just turn it on everywhere and don't rely on // This test is also flaky on Linux Nvidia. So we just turn it on everywhere and don't rely on
// driver since security is important. // driver since security is important.
ANGLE_FEATURE_CONDITION(features, clampArrayAccess, true); ANGLE_FEATURE_CONDITION(
features, clampArrayAccess,
IsAndroid() || isAMD || !functions->hasExtension("GL_KHR_robust_buffer_access_behavior"));
ANGLE_FEATURE_CONDITION(features, resetTexImage2DBaseLevel, ANGLE_FEATURE_CONDITION(features, resetTexImage2DBaseLevel,
IsApple() && isIntel && GetMacOSVersion() >= OSVersion(10, 12, 4)); IsApple() && isIntel && GetMacOSVersion() >= OSVersion(10, 12, 4));