From 0b347ed6dd07f0ffda7fb778530c476d00d5116b Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Fri, 9 Dec 2016 11:20:23 -0700 Subject: layers: GH1244, Fix Compressed BufferImageCopy errs CmdCopyBufferToImage and CmdCopyImageToBuffer were validating compressed image attributes against the valid usage conditions for uncompressed images. Added check for compressed images and skipped this validation, and TODO for future compressed VU addition. Change-Id: I09a7dc98cb0f925c7486ef9f2d6de31411c7ea1c --- layers/core_validation.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index d9793683..647e2090 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -8472,14 +8472,29 @@ static inline bool ValidateCopyBufferImageTransferGranularityRequirements(layer_ const IMAGE_STATE *img, const VkBufferImageCopy *region, const uint32_t i, const char *function) { bool skip = false; - VkExtent3D granularity = GetScaledItg(dev_data, cb_node, img); - skip |= CheckItgSize(dev_data, cb_node, region->bufferOffset, granularity.width, i, function, "bufferOffset"); - skip |= CheckItgInt(dev_data, cb_node, region->bufferRowLength, granularity.width, i, function, "bufferRowLength"); - skip |= CheckItgInt(dev_data, cb_node, region->bufferImageHeight, granularity.width, i, function, "bufferImageHeight"); - skip |= CheckItgOffset(dev_data, cb_node, ®ion->imageOffset, &granularity, i, function, "imageOffset"); - VkExtent3D subresource_extent = GetImageSubresourceExtent(img, ®ion->imageSubresource); - skip |= CheckItgExtent(dev_data, cb_node, ®ion->imageExtent, ®ion->imageOffset, &granularity, &subresource_extent, i, - function, "imageExtent"); + if (vk_format_is_compressed(img->createInfo.format) == true) { + // TODO: Add granularity checking for compressed formats + + // bufferRowLength must be a multiple of the compressed texel block width + // bufferImageHeight must be a multiple of the compressed texel block height + // all members of imageOffset must be a multiple of the corresponding dimensions of the compressed texel block + // bufferOffset must be a multiple of the compressed texel block size in bytes + // imageExtent.width must be a multiple of the compressed texel block width or (imageExtent.width + imageOffset.x) + // must equal the image subresource width + // imageExtent.height must be a multiple of the compressed texel block height or (imageExtent.height + imageOffset.y) + // must equal the image subresource height + // imageExtent.depth must be a multiple of the compressed texel block depth or (imageExtent.depth + imageOffset.z) + // must equal the image subresource depth + } else { + VkExtent3D granularity = GetScaledItg(dev_data, cb_node, img); + skip |= CheckItgSize(dev_data, cb_node, region->bufferOffset, granularity.width, i, function, "bufferOffset"); + skip |= CheckItgInt(dev_data, cb_node, region->bufferRowLength, granularity.width, i, function, "bufferRowLength"); + skip |= CheckItgInt(dev_data, cb_node, region->bufferImageHeight, granularity.width, i, function, "bufferImageHeight"); + skip |= CheckItgOffset(dev_data, cb_node, ®ion->imageOffset, &granularity, i, function, "imageOffset"); + VkExtent3D subresource_extent = GetImageSubresourceExtent(img, ®ion->imageSubresource); + skip |= CheckItgExtent(dev_data, cb_node, ®ion->imageExtent, ®ion->imageOffset, &granularity, &subresource_extent, i, + function, "imageExtent"); + } return skip; } -- cgit v1.2.3