Fix a bug in PassResourceUsageTracker.cpp

In a render/compute pass, if a texture is used as the same usages
across its subresources, and it is also used as different usages
across its subresources. We should mark that it is not used as the
same usages across its subresources for this pass, and we need to
visit every single subresource to track its usages transition.

Bug: dawn:462

Change-Id: Ide0770db62a3b7b85664757b21eb3280a0bb646c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23300
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Yunchao He 2020-06-29 19:00:05 +00:00 committed by Commit Bot service account
parent bf27bd7a5e
commit 1c9e045024
3 changed files with 3 additions and 9 deletions

View File

@ -45,8 +45,8 @@ namespace dawn_native {
// the vector to record every single subresource's Usages. The texture usage is enough. And we
// can decompress texture usage to a vector if necessary.
struct PassTextureUsage {
wgpu::TextureUsage usage;
bool sameUsagesAcrossSubresources;
wgpu::TextureUsage usage = wgpu::TextureUsage::None;
bool sameUsagesAcrossSubresources = true;
std::vector<wgpu::TextureUsage> subresourceUsages;
};

View File

@ -43,7 +43,7 @@ namespace dawn_native {
// Set parameters for the whole texture
textureUsage.usage |= usage;
uint32_t subresourceCount = texture->GetSubresourceCount();
textureUsage.sameUsagesAcrossSubresources = levelCount * layerCount == subresourceCount;
textureUsage.sameUsagesAcrossSubresources &= levelCount * layerCount == subresourceCount;
// Set usages for subresources
if (!textureUsage.subresourceUsages.size()) {

View File

@ -422,9 +422,6 @@ TEST_P(MultisampledRenderingTest, ResolveOneMultisampledTextureTwice) {
// Test using a layer of a 2D texture as resolve target works correctly.
TEST_P(MultisampledRenderingTest, ResolveIntoOneMipmapLevelOf2DTexture) {
// TODO(dawn:462): Investigate backend validation failure.
DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
constexpr uint32_t kBaseMipLevel = 2;
wgpu::TextureViewDescriptor textureViewDescriptor;
@ -462,9 +459,6 @@ TEST_P(MultisampledRenderingTest, ResolveIntoOneMipmapLevelOf2DTexture) {
// Test using a level or a layer of a 2D array texture as resolve target works correctly.
TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
// TODO(dawn:462): Investigate backend validation failure.
DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
wgpu::TextureView multisampledColorView2 =
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();