Support copying multiple array layers in one B2T and T2B copy command

This patch adds the support of copying with multiple texture array
layers in one buffer-to-texture and texture-to-buffer copy command.

BUG=dawn:453
TEST=dawn_end2end_tests

Change-Id: If009dbb29f2b0ef0667715eed0d66053b1491fd4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23248
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao
2020-06-21 09:33:44 +00:00
committed by Commit Bot service account
parent 250f26229b
commit 92379bff49
10 changed files with 413 additions and 215 deletions

View File

@@ -384,6 +384,7 @@ namespace utils {
uint32_t bytesPerRow,
uint32_t rowsPerImage,
uint32_t copyArrayLayerCount) {
ASSERT(rowsPerImage > 0);
const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(format);
const uint32_t bytesAtLastImage = bytesPerRow * (rowsPerImage - 1) + bytesPerTexel * width;
return bytesPerRow * rowsPerImage * (copyArrayLayerCount - 1) + bytesAtLastImage;
@@ -401,11 +402,13 @@ namespace utils {
textureSizeAtLevel0.height >> mipmapLevel, textureSizeAtLevel0.depth};
layout.bytesPerRow = GetMinimumBytesPerRow(format, layout.mipSize.width);
layout.bytesPerImage = layout.bytesPerRow * rowsPerImage;
uint32_t appliedRowsPerImage = rowsPerImage > 0 ? rowsPerImage : layout.mipSize.height;
layout.bytesPerImage = layout.bytesPerRow * appliedRowsPerImage;
layout.byteLength =
GetBytesInBufferTextureCopy(format, layout.mipSize.width, layout.bytesPerRow,
layout.mipSize.height, textureSizeAtLevel0.depth);
appliedRowsPerImage, textureSizeAtLevel0.depth);
const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(format);
layout.texelBlocksPerRow = layout.bytesPerRow / bytesPerTexel;