d3d11: fix and enable some BufferZeroInitTests & Compute tests
Bug: dawn:1755 Bug: dawn:1798 Bug: dawn:1721 Change-Id: I7e5d4964bd248b4429cb393168b0e7dbe119c08c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132001 Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Peng Huang <penghuang@chromium.org>
This commit is contained in:
parent
039e886f9b
commit
91fd9d97a2
|
@ -246,7 +246,20 @@ MaybeError BindGroupTracker::ApplyBindGroup(BindGroupIndex index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case BindingInfoType::StorageTexture: {
|
case BindingInfoType::StorageTexture: {
|
||||||
return DAWN_UNIMPLEMENTED_ERROR("Storage textures are not supported");
|
ASSERT(bindingInfo.storageTexture.access == wgpu::StorageTextureAccess::WriteOnly);
|
||||||
|
ComPtr<ID3D11UnorderedAccessView> d3d11UAV;
|
||||||
|
TextureView* view = ToBackend(group->GetBindingAsTextureView(bindingIndex));
|
||||||
|
DAWN_TRY_ASSIGN(d3d11UAV, view->CreateD3D11UnorderedAccessView());
|
||||||
|
if (bindingInfo.visibility & wgpu::ShaderStage::Fragment) {
|
||||||
|
deviceContext1->OMSetRenderTargetsAndUnorderedAccessViews(
|
||||||
|
D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL, nullptr, nullptr, bindingSlot,
|
||||||
|
1, d3d11UAV.GetAddressOf(), nullptr);
|
||||||
|
}
|
||||||
|
if (bindingInfo.visibility & wgpu::ShaderStage::Compute) {
|
||||||
|
deviceContext1->CSSetUnorderedAccessViews(bindingSlot, 1,
|
||||||
|
d3d11UAV.GetAddressOf(), nullptr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case BindingInfoType::ExternalTexture: {
|
case BindingInfoType::ExternalTexture: {
|
||||||
|
@ -350,8 +363,16 @@ void BindGroupTracker::UnApplyBindGroup(BindGroupIndex index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case BindingInfoType::StorageTexture: {
|
case BindingInfoType::StorageTexture: {
|
||||||
// TODO(dawn:1798): Support storage textures.
|
ASSERT(bindingInfo.storageTexture.access == wgpu::StorageTextureAccess::WriteOnly);
|
||||||
UNREACHABLE();
|
ID3D11UnorderedAccessView* nullUAV = nullptr;
|
||||||
|
if (bindingInfo.visibility & wgpu::ShaderStage::Fragment) {
|
||||||
|
deviceContext1->OMSetRenderTargetsAndUnorderedAccessViews(
|
||||||
|
D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL, nullptr, nullptr, bindingSlot,
|
||||||
|
1, &nullUAV, nullptr);
|
||||||
|
}
|
||||||
|
if (bindingInfo.visibility & wgpu::ShaderStage::Compute) {
|
||||||
|
deviceContext1->CSSetUnorderedAccessViews(bindingSlot, 1, &nullUAV, nullptr);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ MaybeError PipelineLayout::Initialize() {
|
||||||
unsigned int samplerIndex = 0;
|
unsigned int samplerIndex = 0;
|
||||||
unsigned int shaderResourceViewIndex = 0;
|
unsigned int shaderResourceViewIndex = 0;
|
||||||
unsigned int unorderedAccessViewIndex = 0;
|
unsigned int unorderedAccessViewIndex = 0;
|
||||||
unsigned int storageTextureIndex = 0;
|
|
||||||
|
|
||||||
for (BindGroupIndex group : IterateBitSet(GetBindGroupLayoutsMask())) {
|
for (BindGroupIndex group : IterateBitSet(GetBindGroupLayoutsMask())) {
|
||||||
const BindGroupLayoutBase* bgl = GetBindGroupLayout(group);
|
const BindGroupLayoutBase* bgl = GetBindGroupLayout(group);
|
||||||
|
@ -70,7 +69,7 @@ MaybeError PipelineLayout::Initialize() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BindingInfoType::StorageTexture:
|
case BindingInfoType::StorageTexture:
|
||||||
mIndexInfo[group][bindingIndex] = storageTextureIndex++;
|
mIndexInfo[group][bindingIndex] = unorderedAccessViewIndex++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -877,6 +877,9 @@ ResultOrError<ComPtr<ID3D11UnorderedAccessView>> TextureView::CreateD3D11Unorder
|
||||||
uavDesc.Texture1D.MipSlice = GetBaseMipLevel();
|
uavDesc.Texture1D.MipSlice = GetBaseMipLevel();
|
||||||
break;
|
break;
|
||||||
case wgpu::TextureViewDimension::e2D:
|
case wgpu::TextureViewDimension::e2D:
|
||||||
|
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D;
|
||||||
|
uavDesc.Texture2D.MipSlice = GetBaseMipLevel();
|
||||||
|
break;
|
||||||
case wgpu::TextureViewDimension::e2DArray:
|
case wgpu::TextureViewDimension::e2DArray:
|
||||||
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY;
|
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY;
|
||||||
uavDesc.Texture2DArray.FirstArraySlice = GetBaseArrayLayer();
|
uavDesc.Texture2DArray.FirstArraySlice = GetBaseArrayLayer();
|
||||||
|
|
|
@ -169,9 +169,6 @@ class BufferZeroInitTest : public DawnTest {
|
||||||
uint64_t bufferOffset,
|
uint64_t bufferOffset,
|
||||||
uint64_t boundBufferSize,
|
uint64_t boundBufferSize,
|
||||||
const std::vector<uint32_t>& expectedBufferData) {
|
const std::vector<uint32_t>& expectedBufferData) {
|
||||||
// TODO(dawn:1755): Buffer usage can't be both uniform and other accelerated usages with
|
|
||||||
// D3D11.
|
|
||||||
DAWN_SUPPRESS_TEST_IF(IsD3D11());
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.layout = nullptr;
|
pipelineDescriptor.layout = nullptr;
|
||||||
pipelineDescriptor.compute.module = module;
|
pipelineDescriptor.compute.module = module;
|
||||||
|
@ -427,9 +424,6 @@ class BufferZeroInitTest : public DawnTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestBufferZeroInitAsIndirectBufferForDispatchIndirect(uint64_t indirectBufferOffset) {
|
void TestBufferZeroInitAsIndirectBufferForDispatchIndirect(uint64_t indirectBufferOffset) {
|
||||||
// TODO(dawn:1798): Support storage textures.
|
|
||||||
DAWN_SUPPRESS_TEST_IF(IsD3D11());
|
|
||||||
|
|
||||||
constexpr wgpu::TextureFormat kColorAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
constexpr wgpu::TextureFormat kColorAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
constexpr wgpu::Color kClearColorGreen = {0.f, 1.f, 0.f, 1.f};
|
constexpr wgpu::Color kClearColorGreen = {0.f, 1.f, 0.f, 1.f};
|
||||||
|
|
||||||
|
@ -1145,9 +1139,6 @@ TEST_P(BufferZeroInitTest, PaddingInitialized) {
|
||||||
DAWN_SUPPRESS_TEST_IF(IsANGLE()); // TODO(crbug.com/dawn/1084)
|
DAWN_SUPPRESS_TEST_IF(IsANGLE()); // TODO(crbug.com/dawn/1084)
|
||||||
DAWN_SUPPRESS_TEST_IF(IsLinux() && IsVulkan() && IsNvidia()); // TODO(crbug.com/dawn/1214)
|
DAWN_SUPPRESS_TEST_IF(IsLinux() && IsVulkan() && IsNvidia()); // TODO(crbug.com/dawn/1214)
|
||||||
|
|
||||||
// TODO(dawn:1755): Buffer usage can't be both uniform and other accelerated usages with D3D11.
|
|
||||||
DAWN_SUPPRESS_TEST_IF(IsD3D11());
|
|
||||||
|
|
||||||
constexpr wgpu::TextureFormat kColorAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
constexpr wgpu::TextureFormat kColorAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
// A small sub-4-byte format means a single vertex can fit entirely within the padded buffer,
|
// A small sub-4-byte format means a single vertex can fit entirely within the padded buffer,
|
||||||
// touching some of the padding. Test a small format, as well as larger formats.
|
// touching some of the padding. Test a small format, as well as larger formats.
|
||||||
|
|
|
@ -530,10 +530,6 @@ TEST_P(ComputeLayoutMemoryBufferTests, StructMember) {
|
||||||
|
|
||||||
const bool isUniform = GetParam().mAddressSpace == AddressSpace::Uniform;
|
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.
|
||||||
|
@ -705,10 +701,6 @@ TEST_P(ComputeLayoutMemoryBufferTests, NonStructMember) {
|
||||||
|
|
||||||
const bool isUniform = GetParam().mAddressSpace == AddressSpace::Uniform;
|
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;
|
||||||
|
|
|
@ -202,9 +202,6 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP
|
||||||
// Test that Storage to Uniform buffer transitions work and synchronize correctly
|
// Test that Storage to Uniform buffer transitions work and synchronize correctly
|
||||||
// by ping-ponging between Storage/Uniform usage in sequential compute passes.
|
// by ping-ponging between Storage/Uniform usage in sequential compute passes.
|
||||||
TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
|
TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
|
||||||
// TODO(dawn:1721): D3D11 buffer cannot be uniform and storage at the same time.
|
|
||||||
DAWN_SUPPRESS_TEST_IF(IsD3D11());
|
|
||||||
|
|
||||||
std::vector<uint32_t> data(kNumValues, 0);
|
std::vector<uint32_t> data(kNumValues, 0);
|
||||||
std::vector<uint32_t> expectedA(kNumValues, 0x1234 * kIterations);
|
std::vector<uint32_t> expectedA(kNumValues, 0x1234 * kIterations);
|
||||||
std::vector<uint32_t> expectedB(kNumValues, 0x1234 * (kIterations - 1));
|
std::vector<uint32_t> expectedB(kNumValues, 0x1234 * (kIterations - 1));
|
||||||
|
@ -273,9 +270,6 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
|
||||||
// Test that Storage to Uniform buffer transitions work and synchronize correctly
|
// Test that Storage to Uniform buffer transitions work and synchronize correctly
|
||||||
// by ping-ponging between Storage/Uniform usage in one compute pass.
|
// by ping-ponging between Storage/Uniform usage in one compute pass.
|
||||||
TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) {
|
TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) {
|
||||||
// TODO(dawn:1721): D3D11 buffer cannot be uniform and storage at the same time.
|
|
||||||
DAWN_SUPPRESS_TEST_IF(IsD3D11());
|
|
||||||
|
|
||||||
std::vector<uint32_t> data(kNumValues, 0);
|
std::vector<uint32_t> data(kNumValues, 0);
|
||||||
std::vector<uint32_t> expectedA(kNumValues, 0x1234 * kIterations);
|
std::vector<uint32_t> expectedA(kNumValues, 0x1234 * kIterations);
|
||||||
std::vector<uint32_t> expectedB(kNumValues, 0x1234 * (kIterations - 1));
|
std::vector<uint32_t> expectedB(kNumValues, 0x1234 * (kIterations - 1));
|
||||||
|
@ -326,9 +320,9 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) {
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
|
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||||
for (uint32_t i = 0, b = 0; i < kIterations; ++i, b = 1 - b) {
|
for (uint32_t i = 0; i < kIterations; ++i) {
|
||||||
pass.SetPipeline(pipeline);
|
pass.SetPipeline(pipeline);
|
||||||
pass.SetBindGroup(0, bindGroups[b]);
|
pass.SetBindGroup(0, bindGroups[i % 2]);
|
||||||
pass.DispatchWorkgroups(kNumValues / 4);
|
pass.DispatchWorkgroups(kNumValues / 4);
|
||||||
}
|
}
|
||||||
pass.End();
|
pass.End();
|
||||||
|
|
Loading…
Reference in New Issue