D3D12: Use D3D12_BUFFER_UAV_FLAG_RAW when creating unordered access views

Since SPIRV-Cross outputs HLSL shaders with RWByteAddressBuffer,
we must use D3D12_BUFFER_UAV_FLAG_RAW when making the
UNORDERED_ACCESS_VIEW_DESC. Using D3D12_BUFFER_UAV_FLAG_RAW requires
that we use DXGI_FORMAT_R32_TYPELESS as the format of the view.
DXGI_FORMAT_R32_TYPELESS requires that the element size be 4
byte aligned. Since binding.size and binding.offset are in bytes,
we need to divide by 4 to obtain the element size.

Bug: dawn:159
Change-Id: I52481aea1fe190d54286c099a68f3e21dbe05330
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8341
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Rafael Cintron
2019-06-26 08:08:46 +00:00
committed by Commit Bot service account
parent 41c24ee4eb
commit 751252e372
4 changed files with 14 additions and 21 deletions

View File

@@ -97,9 +97,6 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
// Test that a trivial compute-shader memcpy implementation works.
TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) {
// TODO(cwallez@chromium.org): Fails on D3D12, could be a spirv-cross issue?
DAWN_SKIP_TEST_IF(IsD3D12());
BasicTest(R"(
#version 450
#define kInstances 4
@@ -114,7 +111,8 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) {
// Test that a slightly-less-trivial compute-shader memcpy implementation works.
TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) {
// TODO(kainino@chromium.org): Fails on D3D12. Probably due to a limitation in SPIRV-Cross?
// TODO(kainino@chromium.org): Fails on D3D12 due to SPIRV-Cross not supporting
// reading structs from ByteAddressBuffer.
DAWN_SKIP_TEST_IF(IsD3D12());
BasicTest(R"(
@@ -134,9 +132,6 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) {
// Test that a trivial compute-shader memcpy implementation works.
TEST_P(ComputeCopyStorageBufferTests, UnsizedArrayOfBasic) {
// TODO(cwallez@chromium.org): Fails on D3D12, could be a spirv-cross issue?
DAWN_SKIP_TEST_IF(IsD3D12());
BasicTest(R"(
#version 450
#define kInstances 4

View File

@@ -110,8 +110,6 @@ void ComputeIndirectTests::BasicTest(std::initializer_list<uint32_t> bufferList,
// Test basic indirect
TEST_P(ComputeIndirectTests, Basic) {
// See https://bugs.chromium.org/p/dawn/issues/detail?id=159
DAWN_SKIP_TEST_IF(IsD3D12() && IsNvidia());
// TODO(hao.x.li@intel.com): Test failing on Metal with validation layer on, which blocks
// end2end tests run with validation layer in bots. Suppress this while we're fixing.
// See https://bugs.chromium.org/p/dawn/issues/detail?id=139
@@ -122,8 +120,6 @@ TEST_P(ComputeIndirectTests, Basic) {
// Test indirect with buffer offset
TEST_P(ComputeIndirectTests, IndirectOffset) {
// See https://bugs.chromium.org/p/dawn/issues/detail?id=159
DAWN_SKIP_TEST_IF(IsD3D12() && IsNvidia());
// TODO(hao.x.li@intel.com): Test failing on Metal with validation layer on, which blocks
// end2end tests run with validation layer in bots. Suppress this while we're fixing.
// See https://bugs.chromium.org/p/dawn/issues/detail?id=139

View File

@@ -80,9 +80,6 @@ void ComputeSharedMemoryTests::BasicTest(const char* shader) {
// Basic shared memory test
TEST_P(ComputeSharedMemoryTests, Basic) {
// See https://bugs.chromium.org/p/dawn/issues/detail?id=159
DAWN_SKIP_TEST_IF(IsD3D12() && IsNvidia());
BasicTest(R"(
#version 450
const uint kTileSize = 4;