Commit c9bc33cf by Qin Jiajia Committed by Commit Bot

Disable the initialization of shared memory

This patch disables the initialization of shared memory for d3d backend. The initialization of shared memory is very slow and may produce incorrect behavior for some compute shaders on d3d backend. Bug: angleproject:3226 Change-Id: I41f0f061a5611c52af7667f23938fa48819906b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1498385Reviewed-by: 's avatarJamie Madill (use @chromium please) <jmadill@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
parent 0f34f3f2
...@@ -2113,8 +2113,11 @@ bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node) ...@@ -2113,8 +2113,11 @@ bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node)
{ {
symbol->traverse(this); symbol->traverse(this);
out << ArrayString(symbol->getType()); out << ArrayString(symbol->getType());
if (declarator->getQualifier() != EvqShared || // Temporarily disable shadred memory initialization. It is very slow for D3D11
mCompileOptions & SH_INIT_SHARED_VARIABLES) // drivers to compile a compute shader if we add code to initialize a
// groupshared array variable with a large array size. And maybe produce
// incorrect result. See http://anglebug.com/3226.
if (declarator->getQualifier() != EvqShared)
{ {
out << " = " + zeroInitializer(symbol->getType()); out << " = " + zeroInitializer(symbol->getType());
} }
......
...@@ -2378,6 +2378,8 @@ TEST_P(ComputeShaderTestES3, NotSupported) ...@@ -2378,6 +2378,8 @@ TEST_P(ComputeShaderTestES3, NotSupported)
// The contents of shared variables should be cleared to zero at the beginning of shader execution. // The contents of shared variables should be cleared to zero at the beginning of shader execution.
TEST_P(WebGL2ComputeTest, sharedVariablesShouldBeZero) TEST_P(WebGL2ComputeTest, sharedVariablesShouldBeZero)
{ {
// http://anglebug.com/3226
ANGLE_SKIP_TEST_IF(IsD3D11());
const char kCSShader[] = R"(#version 310 es const char kCSShader[] = R"(#version 310 es
layout (local_size_x = 4, local_size_y = 4, local_size_z = 1) in; layout (local_size_x = 4, local_size_y = 4, local_size_z = 1) in;
layout (r32ui, binding = 0) readonly uniform highp uimage2D srcImage; layout (r32ui, binding = 0) readonly uniform highp uimage2D srcImage;
......
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