Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1fdf6ca

Browse files
xhcaoCommit Bot
authored andcommitted
D3D11: Restrict to translate uniform block to StructuredBuffer
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>
1 parent cbbfa2f commit 1fdf6ca

4 files changed

Lines changed: 6 additions & 20 deletions

File tree

include/GLSLANG/ShaderLang.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ const ShCompileOptions SH_ADD_BASE_VERTEX_TO_VERTEX_ID = UINT64_C(1) << 48;
315315
const ShCompileOptions SH_REMOVE_DYNAMIC_INDEXING_OF_SWIZZLED_VECTOR = UINT64_C(1) << 49;
316316

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

321321
// Defines alternate strategies for implementing array index clamping.

include/platform/FeaturesD3D.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,8 @@ struct FeaturesD3D : FeatureSetBase
207207
"Some drivers corrupt texture data when clearing for robust resource initialization.",
208208
&members, "http://crbug.com/941620"};
209209

210-
// Don't translate uniform block to StructuredBuffer on old Windows system with AMD driver.
211-
// This is targeted to work around a bug in AMD D3D driver that fails to allocate
212-
// ShaderResourceView for StructuredBuffer.
210+
// Don't translate uniform block to StructuredBuffer on Windows 7 and earlier. This is targeted
211+
// to work around a bug that fails to allocate ShaderResourceView for StructuredBuffer.
213212
Feature dontTranslateUniformBlockToStructuredBuffer = {
214213
"dont_translate_uniform_block_to_structured_buffer", FeatureCategory::D3DWorkarounds,
215214
"Fails to allocate ShaderResourceView for StructuredBuffer on some drivers", &members};

src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2445,11 +2445,10 @@ void InitializeFeatures(const Renderer11DeviceCaps &deviceCaps,
24452445
// Never clear for robust resource init. This matches Chrome's texture clearning behaviour.
24462446
ANGLE_FEATURE_CONDITION(features, allowClearForRobustResourceInit, false);
24472447

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

24542453
// Call platform hooks for testing overrides.
24552454
auto *platform = ANGLEPlatformCurrent();

src/tests/gl_tests/UniformBufferTest.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,9 +1636,6 @@ TEST_P(UniformBufferTest, LargeArrayOfStructs)
16361636
// member.
16371637
TEST_P(UniformBufferTest, UniformBlockWithOneLargeStructArray)
16381638
{
1639-
// TODO(crbug.com/1037644): Re-enable this test on this config.
1640-
ANGLE_SKIP_TEST_IF(IsWindows7() && IsNVIDIA() && IsD3D11());
1641-
16421639
GLint64 maxUniformBlockSize;
16431640
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &maxUniformBlockSize);
16441641
std::ostringstream stream;
@@ -1751,9 +1748,6 @@ TEST_P(UniformBufferTest, UniformBlockWithOneLargeStructArray)
17511748
// a mat4 member and a float member.
17521749
TEST_P(UniformBufferTest, UniformBlockWithOneLargeMixStructArray)
17531750
{
1754-
// TODO(crbug.com/1037644): Re-enable this test on this config.
1755-
ANGLE_SKIP_TEST_IF(IsWindows7() && IsNVIDIA() && IsD3D11());
1756-
17571751
GLint64 maxUniformBlockSize;
17581752
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &maxUniformBlockSize);
17591753
std::ostringstream stream;
@@ -1884,9 +1878,6 @@ TEST_P(UniformBufferTest, UniformBlockWithOneLargeMixStructArray)
18841878
// struct array member in the same program, and they share a uniform buffer.
18851879
TEST_P(UniformBufferTest, UniformBlocksInSameProgramShareUniformBuffer)
18861880
{
1887-
// TODO(crbug.com/1037644): Re-enable this test on this config.
1888-
ANGLE_SKIP_TEST_IF(IsWindows7() && IsNVIDIA() && IsD3D11());
1889-
18901881
GLint64 maxUniformBlockSize;
18911882
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &maxUniformBlockSize);
18921883
std::ostringstream stream;
@@ -2016,9 +2007,6 @@ TEST_P(UniformBufferTest, UniformBlocksInSameProgramShareUniformBuffer)
20162007
// struct array member in the different programs, and they share a uniform buffer.
20172008
TEST_P(UniformBufferTest, UniformBlocksInDiffProgramShareUniformBuffer)
20182009
{
2019-
// TODO(crbug.com/1037644): Re-enable this test on this config.
2020-
ANGLE_SKIP_TEST_IF(IsWindows7() && IsNVIDIA() && IsD3D11());
2021-
20222010
GLint64 maxUniformBlockSize;
20232011
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &maxUniformBlockSize);
20242012
std::ostringstream stream1;

0 commit comments

Comments
 (0)