Fix buffer copy extents in blit tests
The buffer extents of copies to/from compressed images should account
for the extra size of the compressed block that might not fit in the
actual image but it was not.
Component: Vulkan
Affects: dEQP-VK.api.copy_and_blit.*
Change-Id: Ia4a47554078722b3cd4548df413bcdb62451cba5
diff --git a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp
index c7e351a..45dab70 100644
--- a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp
+++ b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp
@@ -707,11 +707,17 @@
imageExtent.depth
};
+ const bool isCompressed = isCompressedFormat(parms.format);
+ const deUint32 blockWidth = (isCompressed) ? getBlockWidth(parms.format) : 1u;
+ const deUint32 blockHeight = (isCompressed) ? getBlockHeight(parms.format) : 1u;
+ deUint32 rowLength = ((copyExtent.width + blockWidth-1) / blockWidth) * blockWidth;
+ deUint32 imageHeight = ((copyExtent.height + blockHeight-1) / blockHeight) * blockHeight;
+
const VkBufferImageCopy copyRegion =
{
0u, // VkDeviceSize bufferOffset;
- copyExtent.width, // deUint32 bufferRowLength;
- copyExtent.height, // deUint32 bufferImageHeight;
+ rowLength, // deUint32 bufferRowLength;
+ imageHeight, // deUint32 bufferImageHeight;
{
getAspectFlags(imageAccess.getFormat()), // VkImageAspectFlags aspect;
mipLevelNdx, // deUint32 mipLevel;
@@ -910,12 +916,18 @@
};
// Copy image to buffer
+ const bool isCompressed = isCompressedFormat(imageParms.format);
+ const deUint32 blockWidth = (isCompressed) ? getBlockWidth(imageParms.format) : 1u;
+ const deUint32 blockHeight = (isCompressed) ? getBlockHeight(imageParms.format) : 1u;
+ deUint32 rowLength = ((imageExtent.width + blockWidth-1) / blockWidth) * blockWidth;
+ deUint32 imageHeight = ((imageExtent.height + blockHeight-1) / blockHeight) * blockHeight;
+
const VkImageAspectFlags aspect = getAspectFlags(dst.getFormat());
const VkBufferImageCopy copyRegion =
{
0u, // VkDeviceSize bufferOffset;
- imageExtent.width, // deUint32 bufferRowLength;
- imageExtent.height, // deUint32 bufferImageHeight;
+ rowLength, // deUint32 bufferRowLength;
+ imageHeight, // deUint32 bufferImageHeight;
{
aspect, // VkImageAspectFlags aspect;
mipLevel, // deUint32 mipLevel;