From 90586fba571f124e920adc082a72451395ffcb7f Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 6 Mar 2017 17:21:16 -0700 Subject: tests: Bugfix check and add mip copy tests Fixed a bug in the buffer size calculation for compressed mip levels when copying less than a full block at the perimeter. Added a set of validation tests that exercise copies in/out of mip levels of compressed textures. Added an image init() fxn to the test framework that takes an imageCreateInfo input, to allow full control of image varieties. Change-Id: I240ed6e1f45889e58b759f8f261392725dadb498 --- layers/buffer_validation.cpp | 49 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'layers/buffer_validation.cpp') diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 4f83bfe9..4ede7c37 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -2623,7 +2623,8 @@ bool ValidateBufferImageCopyData(const debug_report_data *report_data, uint32_t // image offsets must be multiples of block dimensions if ((vk_safe_modulo(pRegions[i].imageOffset.x, block_size.width) != 0) || - (vk_safe_modulo(pRegions[i].imageOffset.y, block_size.height) != 0)) { + (vk_safe_modulo(pRegions[i].imageOffset.y, block_size.height) != 0) || + (vk_safe_modulo(pRegions[i].imageOffset.z, block_size.depth) != 0)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, reinterpret_cast(image_state->image), __LINE__, VALIDATION_ERROR_01273, "IMAGE", "%s(): pRegion[%d] imageOffset(x,y) (%d, %d) must be multiples of the compressed image's texel " @@ -2645,39 +2646,37 @@ bool ValidateBufferImageCopyData(const debug_report_data *report_data, uint32_t } // imageExtent width must be a multiple of block width, or extent+offset width must equal subresource width + VkExtent3D mip_extent = GetImageSubresourceExtent(image_state, &(pRegions[i].imageSubresource)); if ((vk_safe_modulo(pRegions[i].imageExtent.width, block_size.width) != 0) && - (pRegions[i].imageExtent.width + pRegions[i].imageOffset.x != image_state->createInfo.extent.width)) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - reinterpret_cast(image_state->image), __LINE__, VALIDATION_ERROR_01275, "IMAGE", - "%s(): pRegion[%d] extent width (%d) must be a multiple of the compressed texture block width (%d), or " - "when added to offset.x (%d) must equal the image subresource width (%d). %s.", - function, i, pRegions[i].imageExtent.width, block_size.width, pRegions[i].imageOffset.x, - image_state->createInfo.extent.width, validation_error_map[VALIDATION_ERROR_01275]); + (pRegions[i].imageExtent.width + pRegions[i].imageOffset.x != mip_extent.width)) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast(image_state->image), __LINE__, VALIDATION_ERROR_01275, "IMAGE", + "%s(): pRegion[%d] extent width (%d) must be a multiple of the compressed texture block width " + "(%d), or when added to offset.x (%d) must equal the image subresource width (%d). %s.", + function, i, pRegions[i].imageExtent.width, block_size.width, pRegions[i].imageOffset.x, + mip_extent.width, validation_error_map[VALIDATION_ERROR_01275]); } // imageExtent height must be a multiple of block height, or extent+offset height must equal subresource height if ((vk_safe_modulo(pRegions[i].imageExtent.height, block_size.height) != 0) && - (pRegions[i].imageExtent.height + pRegions[i].imageOffset.y != image_state->createInfo.extent.height)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - reinterpret_cast(image_state->image), __LINE__, VALIDATION_ERROR_01276, "IMAGE", - "%s(): pRegion[%d] extent height (%d) must be a multiple of the compressed texture block height (%d), or " - "when added to offset.y (%d) must equal the image subresource height (%d). %s.", - function, i, pRegions[i].imageExtent.height, block_size.height, pRegions[i].imageOffset.y, - image_state->createInfo.extent.height, validation_error_map[VALIDATION_ERROR_01276]); + (pRegions[i].imageExtent.height + pRegions[i].imageOffset.y != mip_extent.height)) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast(image_state->image), __LINE__, VALIDATION_ERROR_01276, "IMAGE", + "%s(): pRegion[%d] extent height (%d) must be a multiple of the compressed texture block height " + "(%d), or when added to offset.y (%d) must equal the image subresource height (%d). %s.", + function, i, pRegions[i].imageExtent.height, block_size.height, pRegions[i].imageOffset.y, + mip_extent.height, validation_error_map[VALIDATION_ERROR_01276]); } // imageExtent depth must be a multiple of block depth, or extent+offset depth must equal subresource depth if ((vk_safe_modulo(pRegions[i].imageExtent.depth, block_size.depth) != 0) && - (pRegions[i].imageExtent.depth + pRegions[i].imageOffset.z != image_state->createInfo.extent.depth)) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - reinterpret_cast(image_state->image), __LINE__, VALIDATION_ERROR_01277, "IMAGE", - "%s(): pRegion[%d] extent width (%d) must be a multiple of the compressed texture block depth (%d), or " - "when added to offset.z (%d) must equal the image subresource depth (%d). %s.", - function, i, pRegions[i].imageExtent.depth, block_size.depth, pRegions[i].imageOffset.z, - image_state->createInfo.extent.depth, validation_error_map[VALIDATION_ERROR_01277]); + (pRegions[i].imageExtent.depth + pRegions[i].imageOffset.z != mip_extent.depth)) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast(image_state->image), __LINE__, VALIDATION_ERROR_01277, "IMAGE", + "%s(): pRegion[%d] extent width (%d) must be a multiple of the compressed texture block depth " + "(%d), or when added to offset.z (%d) must equal the image subresource depth (%d). %s.", + function, i, pRegions[i].imageExtent.depth, block_size.depth, pRegions[i].imageOffset.z, + mip_extent.depth, validation_error_map[VALIDATION_ERROR_01277]); } } } -- cgit v1.2.3