Implement 3D Texture copy for partial depth slices on D3D12

Note that a slice somehow means a subresource on D3D12. There
are mip slice, array slice, and plane/aspect slice in D3D12.
We reuse the term "slice" for multiple depth of a 3D texture,
although one single depth slice of multiple depth slices is
not a separate subresource of a 3D texture (all these depth
slices for one mip are a separte subresource in 3D texture).

For the reason above, this change also renames "slice" to
"layer" in some functions if "slice" is a layer in that
function. Because a layer is definitely a subresource but a
slice may not be (like a single depth slice of a 3D texture).

Bug: dawn:547
Change-Id: I88b8120ef7f73bfc261fc225f4242924da221654
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/49240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Yunchao He
2021-04-27 20:22:17 +00:00
committed by Commit Bot service account
parent 74326fe2c8
commit ef6a482fb2
4 changed files with 63 additions and 23 deletions

View File

@@ -962,6 +962,26 @@ TEST_P(CopyTests_T2B, Texture3DFull) {
wgpu::TextureDimension::e3D);
}
// Test that copying a range of texture 3D depths in one texture-to-buffer-copy works.
TEST_P(CopyTests_T2B, Texture3DSubRegion) {
// TODO(yunchao.he@intel.com): implement 3D texture copy on Vulkan, Metal, OpenGL and OpenGLES
// backend.
DAWN_SKIP_TEST_IF(IsVulkan() || IsMetal() || IsOpenGL() || IsOpenGLES());
constexpr uint32_t kWidth = 256;
constexpr uint32_t kHeight = 128;
constexpr uint32_t kDepth = 6u;
constexpr uint32_t kBaseDepth = 2u;
constexpr uint32_t kCopyDepth = 3u;
TextureSpec textureSpec;
textureSpec.copyOrigin = {0, 0, kBaseDepth};
textureSpec.textureSize = {kWidth, kHeight, kDepth};
DoTest(textureSpec, MinimumBufferSpec(kWidth, kHeight, kCopyDepth),
{kWidth, kHeight, kCopyDepth}, wgpu::TextureDimension::e3D);
}
// TODO(yunchao.he@intel.com): add T2B tests for 3D textures, like RowPitch,
// RowsPerImage, buffer offset, partial depth range, non-zero level, etc.
@@ -1419,6 +1439,26 @@ TEST_P(CopyTests_B2T, Texture3DFull) {
wgpu::TextureDimension::e3D);
}
// Test that copying a range of texture 3D Depths in one texture-to-buffer-copy works.
TEST_P(CopyTests_B2T, Texture3DSubRegion) {
// TODO(yunchao.he@intel.com): implement 3D texture copy on Vulkan, Metal, OpenGL and OpenGLES
// backend.
DAWN_SKIP_TEST_IF(IsVulkan() || IsMetal() || IsOpenGL() || IsOpenGLES());
constexpr uint32_t kWidth = 256;
constexpr uint32_t kHeight = 128;
constexpr uint32_t kDepth = 6u;
constexpr uint32_t kBaseDepth = 2u;
constexpr uint32_t kCopyDepth = 3u;
TextureSpec textureSpec;
textureSpec.copyOrigin = {0, 0, kBaseDepth};
textureSpec.textureSize = {kWidth, kHeight, kDepth};
DoTest(textureSpec, MinimumBufferSpec(kWidth, kHeight, kCopyDepth),
{kWidth, kHeight, kCopyDepth}, wgpu::TextureDimension::e3D);
}
// TODO(yunchao.he@intel.com): add more tests like RowPitch, RowsPerImage, buffer offset, partial
// depth range, non-zero level, etc.