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>
This commit is contained in:
Peng Huang 2023-05-02 22:29:23 +00:00 committed by Dawn LUCI CQ
parent 3aea647bc2
commit 80cf5e51cc
5 changed files with 23 additions and 4 deletions

View File

@ -66,6 +66,8 @@ MaybeError CommandRecordingContext::Open(Device* device) {
ID3D11Buffer* bufferPtr = mUniformBuffer->GetD3D11Buffer(); ID3D11Buffer* bufferPtr = mUniformBuffer->GetD3D11Buffer();
mD3D11DeviceContext4->VSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1, mD3D11DeviceContext4->VSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1,
&bufferPtr); &bufferPtr);
mD3D11DeviceContext4->CSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1,
&bufferPtr);
} }
mIsOpen = true; mIsOpen = true;
@ -112,6 +114,8 @@ void CommandRecordingContext::Release() {
ID3D11Buffer* nullBuffer = nullptr; ID3D11Buffer* nullBuffer = nullptr;
mD3D11DeviceContext4->VSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1, mD3D11DeviceContext4->VSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1,
&nullBuffer); &nullBuffer);
mD3D11DeviceContext4->CSSetConstantBuffers(PipelineLayout::kReservedConstantBufferSlot, 1,
&nullBuffer);
mD3D11DeviceContext4 = nullptr; mD3D11DeviceContext4 = nullptr;
mD3D11Device = nullptr; mD3D11Device = nullptr;
} }

View File

@ -107,6 +107,9 @@ class ComputeDispatchTests : public DawnTest {
void IndirectTest(std::vector<uint32_t> indirectBufferData, void IndirectTest(std::vector<uint32_t> indirectBufferData,
uint64_t indirectOffset, uint64_t indirectOffset,
bool useNumWorkgroups = true) { 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 // Set up dst storage buffer to contain dispatch x, y, z
wgpu::Buffer dst = utils::CreateBufferFromData<uint32_t>( wgpu::Buffer dst = utils::CreateBufferFromData<uint32_t>(
device, device,
@ -311,6 +314,7 @@ TEST_P(ComputeDispatchTests, ExceedsMaxWorkgroupsWithOffsetNoop) {
} }
DAWN_INSTANTIATE_TEST(ComputeDispatchTests, DAWN_INSTANTIATE_TEST(ComputeDispatchTests,
D3D11Backend(),
D3D12Backend(), D3D12Backend(),
MetalBackend(), MetalBackend(),
OpenGLBackend(), OpenGLBackend(),

View File

@ -500,6 +500,7 @@ fn main() {
} }
DAWN_INSTANTIATE_TEST(ComputeFlowControlTests, DAWN_INSTANTIATE_TEST(ComputeFlowControlTests,
D3D11Backend(),
D3D12Backend(), D3D12Backend(),
MetalBackend(), MetalBackend(),
OpenGLBackend(), OpenGLBackend(),

View File

@ -528,6 +528,12 @@ TEST_P(ComputeLayoutMemoryBufferTests, StructMember) {
// TODO(crbug.com/dawn/1606): find out why these tests fail on Windows for OpenGL. // TODO(crbug.com/dawn/1606): find out why these tests fail on Windows for OpenGL.
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES() && IsWindows()); 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 // Sentinel value markers codes used to check that the start and end of
// structures are correctly aligned. Each of these codes are distinct and // structures are correctly aligned. Each of these codes are distinct and
// are not likely to be confused with data. // are not likely to be confused with data.
@ -549,8 +555,6 @@ TEST_P(ComputeLayoutMemoryBufferTests, StructMember) {
return; return;
} }
const bool isUniform = GetParam().mAddressSpace == AddressSpace::Uniform;
std::string shader = std::string(field.IsRequireF16Feature() ? "enable f16;" : "") + std::string shader = std::string(field.IsRequireF16Feature() ? "enable f16;" : "") +
R"( R"(
struct Data { struct Data {
@ -699,6 +703,12 @@ TEST_P(ComputeLayoutMemoryBufferTests, NonStructMember) {
// TODO(crbug.com/dawn/1606): find out why these tests fail on Windows for OpenGL. // TODO(crbug.com/dawn/1606): find out why these tests fail on Windows for OpenGL.
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES() && IsWindows()); 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(); auto params = GetParam();
Field& field = params.mField; Field& field = params.mField;
@ -712,8 +722,6 @@ TEST_P(ComputeLayoutMemoryBufferTests, NonStructMember) {
return; return;
} }
const bool isUniform = GetParam().mAddressSpace == AddressSpace::Uniform;
std::string shader = std::string(field.IsRequireF16Feature() ? "enable f16;" : "") + std::string shader = std::string(field.IsRequireF16Feature() ? "enable f16;" : "") +
R"( R"(
@group(0) @binding(0) var<{input_qualifiers}> input : {field_type}; @group(0) @binding(0) var<{input_qualifiers}> input : {field_type};
@ -778,6 +786,7 @@ fn main() {
auto GenerateParams() { auto GenerateParams() {
auto params = MakeParamGenerator<ComputeLayoutMemoryBufferTestParams>( auto params = MakeParamGenerator<ComputeLayoutMemoryBufferTestParams>(
{ {
D3D11Backend(),
D3D12Backend(), D3D12Backend(),
D3D12Backend({"use_dxc"}), D3D12Backend({"use_dxc"}),
MetalBackend(), MetalBackend(),

View File

@ -197,6 +197,7 @@ TEST_P(ComputeSharedMemoryTests, AssortedTypes) {
} }
DAWN_INSTANTIATE_TEST(ComputeSharedMemoryTests, DAWN_INSTANTIATE_TEST(ComputeSharedMemoryTests,
D3D11Backend(),
D3D12Backend(), D3D12Backend(),
MetalBackend(), MetalBackend(),
OpenGLBackend(), OpenGLBackend(),