Commit eca11cc8 by shrekshao Committed by Commit Bot

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/+/2026029Reviewed-by: 's avatarJames Darpinian <jdarpinian@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Shrek Shao <shrekshao@google.com>
parent b91acdcf
......@@ -128,6 +128,7 @@ const ShCompileOptions SH_ENFORCE_PACKING_RESTRICTIONS = UINT64_C(1) << 9;
// vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
// specified in the ShBuiltInResources when constructing the
// 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;
// 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.
if (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS && mShaderType != GL_COMPUTE_SHADER)
if (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS)
{
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;
}
if (features.clampArrayAccess.enabled)
if (features.clampArrayAccess.enabled || isWebGL)
{
additionalOptions |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS;
}
......
......@@ -1601,7 +1601,9 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
// 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
// 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,
IsApple() && isIntel && GetMacOSVersion() >= OSVersion(10, 12, 4));
......
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