Support depth-only/stencil-only copies on D3D12

Bug: dawn:439
Change-Id: I919a5e7bcb46f1817f9b15aaf49a1a72680aa47a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24960
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng
2020-08-12 01:57:54 +00:00
committed by Commit Bot service account
parent 11c0f579b1
commit 37f547456c
10 changed files with 87 additions and 52 deletions

View File

@@ -320,4 +320,4 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
}
}
DAWN_INSTANTIATE_TEST(DepthStencilCopyTests, MetalBackend(), VulkanBackend());
DAWN_INSTANTIATE_TEST(DepthStencilCopyTests, D3D12Backend(), MetalBackend(), VulkanBackend());

View File

@@ -651,10 +651,12 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_StencilOnly));
// TODO(crbug.com/dawn/439): Implement stencil copies on other platforms
if (IsMetal() || IsVulkan()) {
if (IsMetal() || IsVulkan() || IsD3D12()) {
// Check by copy that the stencil data is 2.
EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_EQ(uint8_t(2), depthStencilTexture, 0, 0, 0, 0,
wgpu::TextureAspect::StencilOnly));
std::vector<uint8_t> expected(kSize * kSize, 2);
EXPECT_LAZY_CLEAR(
0u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, 0, 0, kSize, kSize, 0,
0, wgpu::TextureAspect::StencilOnly));
}
}
@@ -722,10 +724,12 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_StencilOnly));
// TODO(crbug.com/dawn/439): Implement stencil copies on other platforms
if (IsMetal() || IsVulkan()) {
if (IsMetal() || IsVulkan() || IsD3D12()) {
// Check by copy that the stencil data is 0.
EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_EQ(uint8_t(0), depthStencilTexture, 0, 0, 0, 0,
wgpu::TextureAspect::StencilOnly));
std::vector<uint8_t> expected(kSize * kSize, 0);
EXPECT_LAZY_CLEAR(
0u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, 0, 0, kSize, kSize, 0,
0, wgpu::TextureAspect::StencilOnly));
}
}
}
@@ -734,7 +738,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
// Lazy clear of the stencil aspect via copy should not touch depth.
TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
// TODO(crbug.com/dawn/439): Implement stencil copies on other platforms
DAWN_SKIP_TEST_IF(!(IsMetal() || IsVulkan()));
DAWN_SKIP_TEST_IF(!(IsMetal() || IsVulkan() || IsD3D12()));
// TODO(enga): Figure out why this fails on Metal Intel.
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
@@ -767,8 +771,9 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_StencilOnly));
// Check by copy that the stencil data is lazily cleared to 0.
EXPECT_LAZY_CLEAR(1u, EXPECT_TEXTURE_EQ(uint8_t(0), depthStencilTexture, 0, 0, 0, 0,
wgpu::TextureAspect::StencilOnly));
std::vector<uint8_t> expected(kSize * kSize, 0);
EXPECT_LAZY_CLEAR(1u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, 0, 0, kSize,
kSize, 0, 0, wgpu::TextureAspect::StencilOnly));
// Everything is initialized now
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, 0,