Skip to content

Commit

Permalink
D3D11: Restrict to translate uniform block to StructuredBuffer
Browse files Browse the repository at this point in the history
Only translate uniform block to StructuredBuffer when system is
Windows 10 and later.

Bug: angleproject:3682
Change-Id: I27e3f4503392791883a44e1d486ffe9512e04bd8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1984863
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
  • Loading branch information
xhcao authored and Commit Bot committed Jan 2, 2020
1 parent cbbfa2f commit 1fdf6ca
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion include/GLSLANG/ShaderLang.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const ShCompileOptions SH_ADD_BASE_VERTEX_TO_VERTEX_ID = UINT64_C(1) << 48;
const ShCompileOptions SH_REMOVE_DYNAMIC_INDEXING_OF_SWIZZLED_VECTOR = UINT64_C(1) << 49;

// This flag works a driver bug that fails to allocate ShaderResourceView for StructuredBuffer
// on old Windows system with AMD driver.
// on Windows 7 and earlier.
const ShCompileOptions SH_DONT_TRANSLATE_UNIFORM_BLOCK_TO_STRUCTUREDBUFFER = UINT64_C(1) << 50;

// Defines alternate strategies for implementing array index clamping.
Expand Down
5 changes: 2 additions & 3 deletions include/platform/FeaturesD3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,8 @@ struct FeaturesD3D : FeatureSetBase
"Some drivers corrupt texture data when clearing for robust resource initialization.",
&members, "http://crbug.com/941620"};

// Don't translate uniform block to StructuredBuffer on old Windows system with AMD driver.
// This is targeted to work around a bug in AMD D3D driver that fails to allocate
// ShaderResourceView for StructuredBuffer.
// Don't translate uniform block to StructuredBuffer on Windows 7 and earlier. This is targeted
// to work around a bug that fails to allocate ShaderResourceView for StructuredBuffer.
Feature dontTranslateUniformBlockToStructuredBuffer = {
"dont_translate_uniform_block_to_structured_buffer", FeatureCategory::D3DWorkarounds,
"Fails to allocate ShaderResourceView for StructuredBuffer on some drivers", &members};
Expand Down
7 changes: 3 additions & 4 deletions src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2445,11 +2445,10 @@ void InitializeFeatures(const Renderer11DeviceCaps &deviceCaps,
// Never clear for robust resource init. This matches Chrome's texture clearning behaviour.
ANGLE_FEATURE_CONDITION(features, allowClearForRobustResourceInit, false);

// Don't translate uniform block to StructuredBuffer on old Windows system with AMD driver.
// This is targeted to work around a bug in AMD D3D driver that fails to allocate
// ShaderResourceView for StructuredBuffer.
// Don't translate uniform block to StructuredBuffer on Windows 7 and earlier. This is targeted
// to work around a bug that fails to allocate ShaderResourceView for StructuredBuffer.
ANGLE_FEATURE_CONDITION(features, dontTranslateUniformBlockToStructuredBuffer,
isAMD && !IsWindows10OrGreater());
!IsWindows10OrGreater());

// Call platform hooks for testing overrides.
auto *platform = ANGLEPlatformCurrent();
Expand Down
12 changes: 0 additions & 12 deletions src/tests/gl_tests/UniformBufferTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,9 +1636,6 @@ TEST_P(UniformBufferTest, LargeArrayOfStructs)
// member.
TEST_P(UniformBufferTest, UniformBlockWithOneLargeStructArray)
{
// TODO(crbug.com/1037644): Re-enable this test on this config.
ANGLE_SKIP_TEST_IF(IsWindows7() && IsNVIDIA() && IsD3D11());

GLint64 maxUniformBlockSize;
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &maxUniformBlockSize);
std::ostringstream stream;
Expand Down Expand Up @@ -1751,9 +1748,6 @@ TEST_P(UniformBufferTest, UniformBlockWithOneLargeStructArray)
// a mat4 member and a float member.
TEST_P(UniformBufferTest, UniformBlockWithOneLargeMixStructArray)
{
// TODO(crbug.com/1037644): Re-enable this test on this config.
ANGLE_SKIP_TEST_IF(IsWindows7() && IsNVIDIA() && IsD3D11());

GLint64 maxUniformBlockSize;
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &maxUniformBlockSize);
std::ostringstream stream;
Expand Down Expand Up @@ -1884,9 +1878,6 @@ TEST_P(UniformBufferTest, UniformBlockWithOneLargeMixStructArray)
// struct array member in the same program, and they share a uniform buffer.
TEST_P(UniformBufferTest, UniformBlocksInSameProgramShareUniformBuffer)
{
// TODO(crbug.com/1037644): Re-enable this test on this config.
ANGLE_SKIP_TEST_IF(IsWindows7() && IsNVIDIA() && IsD3D11());

GLint64 maxUniformBlockSize;
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &maxUniformBlockSize);
std::ostringstream stream;
Expand Down Expand Up @@ -2016,9 +2007,6 @@ TEST_P(UniformBufferTest, UniformBlocksInSameProgramShareUniformBuffer)
// struct array member in the different programs, and they share a uniform buffer.
TEST_P(UniformBufferTest, UniformBlocksInDiffProgramShareUniformBuffer)
{
// TODO(crbug.com/1037644): Re-enable this test on this config.
ANGLE_SKIP_TEST_IF(IsWindows7() && IsNVIDIA() && IsD3D11());

GLint64 maxUniformBlockSize;
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &maxUniformBlockSize);
std::ostringstream stream1;
Expand Down

0 comments on commit 1fdf6ca

Please sign in to comment.