Support multiple array layers in one texture-to-texture copy command

This patch adds the supports of copying multiple array layers of a
2D array texture in one texture-to-texture call. Note that in D3D12
and Metal it is implemented by copying each array layer in a for-loop.

Note that we need extra validations when the source and destination
texture are the same one in a texture-to-texture copy. This CL does
not include these validations and we will add them in another one.

BUG=dawn:18
TEST=dawn_unittests, dawn_end2end_tests

Change-Id: I1239543e5692e140474b3c1de0b3579be449e283
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22140
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Jiawei Shao
2020-05-28 01:01:32 +00:00
committed by Commit Bot service account
parent f62ab75a5c
commit a3636ed888
7 changed files with 167 additions and 114 deletions

View File

@@ -623,17 +623,17 @@ namespace dawn_native { namespace opengl {
srcTexture->EnsureSubresourceContentInitialized(src.mipLevel, 1, src.arrayLayer,
1);
if (IsCompleteSubresourceCopiedTo(dstTexture, copySize, dst.mipLevel)) {
dstTexture->SetIsSubresourceContentInitialized(true, dst.mipLevel, 1,
dst.arrayLayer, 1);
dstTexture->SetIsSubresourceContentInitialized(
true, dst.mipLevel, 1, dst.arrayLayer, copy->copySize.depth);
} else {
dstTexture->EnsureSubresourceContentInitialized(dst.mipLevel, 1,
dst.arrayLayer, 1);
dstTexture->EnsureSubresourceContentInitialized(
dst.mipLevel, 1, dst.arrayLayer, copy->copySize.depth);
}
gl.CopyImageSubData(srcTexture->GetHandle(), srcTexture->GetGLTarget(),
src.mipLevel, src.origin.x, src.origin.y, src.arrayLayer,
dstTexture->GetHandle(), dstTexture->GetGLTarget(),
dst.mipLevel, dst.origin.x, dst.origin.y, dst.arrayLayer,
copySize.width, copySize.height, 1);
copySize.width, copySize.height, copy->copySize.depth);
break;
}