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>
This commit is contained in:
Xinghua Cao 2019-12-31 14:25:35 +08:00 коммит произвёл Commit Bot
Родитель cbbfa2f28a
Коммит 1fdf6ca514
4 изменённых файлов: 6 добавлений и 20 удалений

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

@ -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.

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

@ -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};

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

@ -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();

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

@ -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;
@ -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;
@ -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;
@ -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;