Enable CopyTests_T2T/CopyWithinSameTexture* tests on D3D12

This patch enables the tests CopyTests_T2T/CopyWithinSameTexture* on
D3D12 after the D3D12 texture subresource tracking has been supported.

This patch also changes the related comment in Vulkan as WebGPU CG has
already decided to disallow the overlaps among source and destination
subresources in texture-to-texture copies.

BUG=dawn:453
TEST=dawn_end2end_tests

Change-Id: Ibf008c800cfea62658050f565f321a391412c54c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23000
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Jiawei Shao 2020-06-10 21:38:50 +00:00 committed by Commit Bot service account
parent 18992f7be9
commit 15cbb6b76a
3 changed files with 14 additions and 8 deletions

View File

@ -17,6 +17,7 @@
#include "common/Assert.h"
#include "dawn_native/BindGroupAndStorageBarrierTracker.h"
#include "dawn_native/CommandEncoder.h"
#include "dawn_native/CommandValidation.h"
#include "dawn_native/Commands.h"
#include "dawn_native/RenderBundle.h"
#include "dawn_native/d3d12/BindGroupD3D12.h"
@ -689,6 +690,17 @@ namespace dawn_native { namespace d3d12 {
commandContext, copy->destination.mipLevel, 1,
copy->destination.arrayLayer, copy->copySize.depth);
}
if (copy->source.texture.Get() == copy->destination.texture.Get() &&
copy->source.mipLevel == copy->destination.mipLevel) {
// When there are overlapped subresources, the layout of the overlapped
// subresources should all be COMMON instead of what we set now. Currently
// it is not allowed to copy with overlapped subresources, but we still
// add the ASSERT here as a reminder for this possible misuse.
ASSERT(!IsRangeOverlapped(copy->source.arrayLayer,
copy->destination.arrayLayer,
copy->copySize.depth));
}
source->TrackUsageAndTransitionNow(
commandContext, wgpu::TextureUsage::CopySrc, copy->source.mipLevel, 1,
copy->source.arrayLayer, copy->copySize.depth);

View File

@ -528,7 +528,7 @@ namespace dawn_native { namespace vulkan {
// When there are overlapped subresources, the layout of the overlapped
// subresources should all be GENERAL instead of what we set now. Currently
// it is not allowed to copy with overlapped subresources, but we still
// add the ASSERT here as a reminder for possible changes in the future.
// add the ASSERT here as a reminder for this possible misuse.
ASSERT(!IsRangeOverlapped(src.arrayLayer, dst.arrayLayer,
copy->copySize.depth));
}

View File

@ -769,10 +769,6 @@ TEST_P(CopyTests_T2T, Texture2DArrayCopyMultipleSlices) {
// Test copying one texture slice within the same texture.
TEST_P(CopyTests_T2T, CopyWithinSameTextureOneSlice) {
// TODO(jiawei.shao@intel.com): support texture-to-texture copy within same texture on D3D12
// after D3D12 subresource tracking is implemented.
DAWN_SKIP_TEST_IF(IsD3D12());
constexpr uint32_t kWidth = 256u;
constexpr uint32_t kHeight = 128u;
constexpr uint32_t kLayers = 6u;
@ -788,9 +784,7 @@ TEST_P(CopyTests_T2T, CopyWithinSameTextureOneSlice) {
// slices.
TEST_P(CopyTests_T2T, CopyWithinSameTextureNonOverlappedSlices) {
// TODO(jiawei.shao@intel.com): investigate why this test fails with swiftshader.
// TODO(jiawei.shao@intel.com): support texture-to-texture copy within same texture on D3D12
// after D3D12 subresource tracking is implemented.
DAWN_SKIP_TEST_IF(IsSwiftshader() || IsD3D12());
DAWN_SKIP_TEST_IF(IsSwiftshader());
constexpr uint32_t kWidth = 256u;
constexpr uint32_t kHeight = 128u;