Reset root descriptor table for samplers when descriptor heaps are changed

When shader-visible heap switch happens, we re-populate all bindgroups
and change the descriptor heaps, which need to reset root descriptor
tables, but for the samplers which are cached in
mBoundRootSamplerTables and not changed, they won't be reset, which make
shaders cannot access the sampler heaps.

Bug: dawn:1255

Change-Id: Icc142206121af9daf8b9352b4c639f7d7ef8f1d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Li Hao 2022-02-15 02:05:06 +00:00 committed by Dawn LUCI CQ
parent 058334829b
commit 3a60f96079
2 changed files with 6 additions and 3 deletions

View File

@ -390,6 +390,12 @@ namespace dawn::native::d3d12 {
ASSERT(descriptorHeaps[0] != nullptr);
ASSERT(descriptorHeaps[1] != nullptr);
commandList->SetDescriptorHeaps(descriptorHeaps.size(), descriptorHeaps.data());
// Descriptor table state is undefined at the beginning of a command list and after
// descriptor heaps are changed on a command list. Invalidate the root sampler tables to
// reset the root descriptor table for samplers, otherwise the shader cannot access the
// descriptor heaps.
mBoundRootSamplerTables = {};
}
private:

View File

@ -740,9 +740,6 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled(
dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting));
// TODO(crbug.com/dawn/1255): Fails on Win11 with D3D12 debug layer and full validation
DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
// Create a solid filled texture.
wgpu::TextureDescriptor descriptor;
descriptor.dimension = wgpu::TextureDimension::e2D;