d3d11: enable some compute shader tests

Known issues:
 d3d11 buffer cannot be uniform and storage at same time.
 DispatchWorkgroupsIndirect doesn't work correctly.

Bug: dawn:1705
Bug: dawn:1791
Bug: dawn:1792
Change-Id: I14df33c441198fcde9063ad85251da30c4b12c6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131060
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/native/d3d11/CommandRecordingContextD3D11.cpp b/src/dawn/native/d3d11/CommandRecordingContextD3D11.cpp
index 03bd81a..bfbc052 100644
--- a/src/dawn/native/d3d11/CommandRecordingContextD3D11.cpp
+++ b/src/dawn/native/d3d11/CommandRecordingContextD3D11.cpp
@@ -66,6 +66,8 @@
         ID3D11Buffer* bufferPtr = mUniformBuffer->GetD3D11Buffer();
         mD3D11DeviceContext4->VSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1,
                                                    &bufferPtr);
+        mD3D11DeviceContext4->CSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1,
+                                                   &bufferPtr);
     }
 
     mIsOpen = true;
@@ -112,6 +114,8 @@
         ID3D11Buffer* nullBuffer = nullptr;
         mD3D11DeviceContext4->VSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1,
                                                    &nullBuffer);
+        mD3D11DeviceContext4->CSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1,
+                                                   &nullBuffer);
         mD3D11DeviceContext4 = nullptr;
         mD3D11Device = nullptr;
     }
diff --git a/src/dawn/tests/end2end/ComputeDispatchTests.cpp b/src/dawn/tests/end2end/ComputeDispatchTests.cpp
index 23555a5..802ae74 100644
--- a/src/dawn/tests/end2end/ComputeDispatchTests.cpp
+++ b/src/dawn/tests/end2end/ComputeDispatchTests.cpp
@@ -107,6 +107,9 @@
     void IndirectTest(std::vector<uint32_t> indirectBufferData,
                       uint64_t indirectOffset,
                       bool useNumWorkgroups = true) {
+        // TODO(dawn:1791): fix indirect dispatch on D3D11
+        DAWN_SUPPRESS_TEST_IF(IsD3D11());
+
         // Set up dst storage buffer to contain dispatch x, y, z
         wgpu::Buffer dst = utils::CreateBufferFromData<uint32_t>(
             device,
@@ -311,6 +314,7 @@
 }
 
 DAWN_INSTANTIATE_TEST(ComputeDispatchTests,
+                      D3D11Backend(),
                       D3D12Backend(),
                       MetalBackend(),
                       OpenGLBackend(),
diff --git a/src/dawn/tests/end2end/ComputeFlowControlTests.cpp b/src/dawn/tests/end2end/ComputeFlowControlTests.cpp
index 933ffaf..6c22093 100644
--- a/src/dawn/tests/end2end/ComputeFlowControlTests.cpp
+++ b/src/dawn/tests/end2end/ComputeFlowControlTests.cpp
@@ -500,6 +500,7 @@
 }
 
 DAWN_INSTANTIATE_TEST(ComputeFlowControlTests,
+                      D3D11Backend(),
                       D3D12Backend(),
                       MetalBackend(),
                       OpenGLBackend(),
diff --git a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp
index 734d82c..815e207 100644
--- a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp
+++ b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp
@@ -528,6 +528,12 @@
     // TODO(crbug.com/dawn/1606): find out why these tests fail on Windows for OpenGL.
     DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES() && IsWindows());
 
+    const bool isUniform = GetParam().mAddressSpace == AddressSpace::Uniform;
+
+    // D3D11 doesn't support storage buffer with uniform address space
+    // TODO(dawn:1792): figure how to support it on D3D11
+    DAWN_SUPPRESS_TEST_IF(IsD3D11() && isUniform);
+
     // Sentinel value markers codes used to check that the start and end of
     // structures are correctly aligned. Each of these codes are distinct and
     // are not likely to be confused with data.
@@ -549,8 +555,6 @@
         return;
     }
 
-    const bool isUniform = GetParam().mAddressSpace == AddressSpace::Uniform;
-
     std::string shader = std::string(field.IsRequireF16Feature() ? "enable f16;" : "") +
                          R"(
 struct Data {
@@ -699,6 +703,12 @@
     // TODO(crbug.com/dawn/1606): find out why these tests fail on Windows for OpenGL.
     DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES() && IsWindows());
 
+    const bool isUniform = GetParam().mAddressSpace == AddressSpace::Uniform;
+
+    // D3D11 doesn't support storage buffer with uniform address space
+    // TODO(dawn:1792): figure how to support it on D3D11
+    DAWN_SUPPRESS_TEST_IF(IsD3D11() && isUniform);
+
     auto params = GetParam();
 
     Field& field = params.mField;
@@ -712,8 +722,6 @@
         return;
     }
 
-    const bool isUniform = GetParam().mAddressSpace == AddressSpace::Uniform;
-
     std::string shader = std::string(field.IsRequireF16Feature() ? "enable f16;" : "") +
                          R"(
 @group(0) @binding(0) var<{input_qualifiers}> input : {field_type};
@@ -778,6 +786,7 @@
 auto GenerateParams() {
     auto params = MakeParamGenerator<ComputeLayoutMemoryBufferTestParams>(
         {
+            D3D11Backend(),
             D3D12Backend(),
             D3D12Backend({"use_dxc"}),
             MetalBackend(),
diff --git a/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp b/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp
index e395517..57ad5b6 100644
--- a/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp
+++ b/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp
@@ -197,6 +197,7 @@
 }
 
 DAWN_INSTANTIATE_TEST(ComputeSharedMemoryTests,
+                      D3D11Backend(),
                       D3D12Backend(),
                       MetalBackend(),
                       OpenGLBackend(),