Implement depth-only/stencil-only copies on Vulkan and Metal
Bug: dawn:439
Change-Id: I07ab014f4f13b73c09b2eecc48cd38b06d88166a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24684
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/vulkan/UtilsVulkan.cpp b/src/dawn_native/vulkan/UtilsVulkan.cpp
index 15011ce..b7116da 100644
--- a/src/dawn_native/vulkan/UtilsVulkan.cpp
+++ b/src/dawn_native/vulkan/UtilsVulkan.cpp
@@ -84,12 +84,14 @@
region.bufferOffset = dataLayout.offset;
// In Vulkan the row length is in texels while it is in bytes for Dawn
- const Format& format = texture->GetFormat();
- ASSERT(dataLayout.bytesPerRow % format.blockByteSize == 0);
- region.bufferRowLength = dataLayout.bytesPerRow / format.blockByteSize * format.blockWidth;
+ const TexelBlockInfo& blockInfo =
+ texture->GetFormat().GetTexelBlockInfo(textureCopy.aspect);
+ ASSERT(dataLayout.bytesPerRow % blockInfo.blockByteSize == 0);
+ region.bufferRowLength =
+ dataLayout.bytesPerRow / blockInfo.blockByteSize * blockInfo.blockWidth;
region.bufferImageHeight = dataLayout.rowsPerImage;
- region.imageSubresource.aspectMask = texture->GetVkAspectMask();
+ region.imageSubresource.aspectMask = texture->GetVkAspectMask(textureCopy.aspect);
region.imageSubresource.mipLevel = textureCopy.mipLevel;
switch (textureCopy.texture->GetDimension()) {
@@ -115,4 +117,4 @@
return region;
}
-}} // namespace dawn_native::vulkan
\ No newline at end of file
+}} // namespace dawn_native::vulkan