Implementing Queue::WriteTexture in Vulkan
Added implementation of writeTexture in Vulkan.
Bug: dawn:483
Change-Id: Id74b6518c46caf59e07a9d16dd51d8c28340fd50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24660
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/vulkan/UtilsVulkan.cpp b/src/dawn_native/vulkan/UtilsVulkan.cpp
index 74e825b..15011ce 100644
--- a/src/dawn_native/vulkan/UtilsVulkan.cpp
+++ b/src/dawn_native/vulkan/UtilsVulkan.cpp
@@ -68,16 +68,26 @@
VkBufferImageCopy ComputeBufferImageCopyRegion(const BufferCopy& bufferCopy,
const TextureCopy& textureCopy,
const Extent3D& copySize) {
+ TextureDataLayout passDataLayout;
+ passDataLayout.offset = bufferCopy.offset;
+ passDataLayout.rowsPerImage = bufferCopy.rowsPerImage;
+ passDataLayout.bytesPerRow = bufferCopy.bytesPerRow;
+ return ComputeBufferImageCopyRegion(passDataLayout, textureCopy, copySize);
+ }
+
+ VkBufferImageCopy ComputeBufferImageCopyRegion(const TextureDataLayout& dataLayout,
+ const TextureCopy& textureCopy,
+ const Extent3D& copySize) {
const Texture* texture = ToBackend(textureCopy.texture.Get());
VkBufferImageCopy region;
- region.bufferOffset = bufferCopy.offset;
+ 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(bufferCopy.bytesPerRow % format.blockByteSize == 0);
- region.bufferRowLength = bufferCopy.bytesPerRow / format.blockByteSize * format.blockWidth;
- region.bufferImageHeight = bufferCopy.rowsPerImage;
+ ASSERT(dataLayout.bytesPerRow % format.blockByteSize == 0);
+ region.bufferRowLength = dataLayout.bytesPerRow / format.blockByteSize * format.blockWidth;
+ region.bufferImageHeight = dataLayout.rowsPerImage;
region.imageSubresource.aspectMask = texture->GetVkAspectMask();
region.imageSubresource.mipLevel = textureCopy.mipLevel;
@@ -105,4 +115,4 @@
return region;
}
-}} // namespace dawn_native::vulkan
+}} // namespace dawn_native::vulkan
\ No newline at end of file