From: Mark Lobodzinski Date: Mon, 6 Feb 2017 22:04:23 +0000 (-0700) Subject: layers: Fixed some blitimage VUs X-Git-Tag: upstream/1.1.92~1627 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e29da03f6e7a3028855c19979a111053773fa65c;p=platform%2Fupstream%2FVulkan-Tools.git layers: Fixed some blitimage VUs There were three checks which were improperly limited to depth-stencil aspects. Two of the checks (for zero layerCounts) are also not prohibited by the spec (for ImageBlit structures, anyhow) and so have been changed to warnings. The remaining check for matching src and dest layerCounts was moved and had the correct VU ID added. Change-Id: Idb37fa94e4359e25c7bdcaed8ad65c2ddddefe0d --- diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 772f39b..0d5df23 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -1287,8 +1287,9 @@ bool PreCallValidateCmdBlitImage(core_validation::layer_data *device_data, GLOBA skip |= ValidateCmd(device_data, cb_node, CMD_BLITIMAGE, "vkCmdBlitImage()"); skip |= insideRenderPass(device_data, cb_node, "vkCmdBlitImage()", VALIDATION_ERROR_01300); - // Warn for zero-sized regions for (uint32_t i = 0; i < regionCount; i++) { + + // Warn for zero-sized regions if ((pRegions[i].srcOffsets[0].x == pRegions[i].srcOffsets[1].x) || (pRegions[i].srcOffsets[0].y == pRegions[i].srcOffsets[1].y) || (pRegions[i].srcOffsets[0].z == pRegions[i].srcOffsets[1].z)) { @@ -1307,6 +1308,27 @@ bool PreCallValidateCmdBlitImage(core_validation::layer_data *device_data, GLOBA reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_EXTENTS, "IMAGE", "%s", ss.str().c_str()); } + if (pRegions[i].srcSubresource.layerCount == 0) { + char const str[] = "vkCmdBlitImage: number of layers in source subresource is zero"; + skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_MISMATCHED_IMAGE_ASPECT, + "IMAGE", str); + } + if (pRegions[i].dstSubresource.layerCount == 0) { + char const str[] = "vkCmdBlitImage: number of layers in destination subresource is zero"; + skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_MISMATCHED_IMAGE_ASPECT, + "IMAGE", str); + } + + // Check that src/dst layercounts match + if (pRegions[i].srcSubresource.layerCount != pRegions[i].dstSubresource.layerCount) { + skip |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, VALIDATION_ERROR_01304, "IMAGE", + "vkCmdBlitImage: layerCount in source and destination subresource of pRegions[%d] does not match. %s", + i, validation_error_map[VALIDATION_ERROR_01304]); + } } VkFormat src_format = src_image_state->createInfo.format; @@ -1336,6 +1358,7 @@ bool PreCallValidateCmdBlitImage(core_validation::layer_data *device_data, GLOBA // Validate aspect bits and formats for depth/stencil images if (vk_format_is_depth_or_stencil(src_format) || vk_format_is_depth_or_stencil(dst_format)) { + if (src_format != dst_format) { std::stringstream ss; ss << "vkCmdBlitImage: If one of srcImage and dstImage images has a format of depth, stencil or depth " @@ -1347,31 +1370,7 @@ bool PreCallValidateCmdBlitImage(core_validation::layer_data *device_data, GLOBA "%s. %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_02192]); } - // TODO: Confirm that all these checks are intended to be nested under depth/stencil only for (uint32_t i = 0; i < regionCount; i++) { - if (pRegions[i].srcSubresource.layerCount == 0) { - char const str[] = "vkCmdBlitImage: number of layers in source subresource is zero"; - // TODO: Verify against Valid Use section of spec, if this case yields undefined results, then it's an error - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_MISMATCHED_IMAGE_ASPECT, - "IMAGE", str); - } - - if (pRegions[i].dstSubresource.layerCount == 0) { - char const str[] = "vkCmdBlitImage: number of layers in destination subresource is zero"; - // TODO: Verify against Valid Use section of spec, if this case yields undefined results, then it's an error - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_MISMATCHED_IMAGE_ASPECT, - "IMAGE", str); - } - - if (pRegions[i].srcSubresource.layerCount != pRegions[i].dstSubresource.layerCount) { - char const str[] = "vkCmdBlitImage: number of layers in source and destination subresources must match"; - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_MISMATCHED_IMAGE_ASPECT, - "IMAGE", str); - } - VkImageAspectFlags srcAspect = pRegions[i].srcSubresource.aspectMask; VkImageAspectFlags dstAspect = pRegions[i].dstSubresource.aspectMask; diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 651f2cc..0d335d6 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -6291,8 +6291,8 @@ static bool ValidateImageAspectMask(layer_data *dev_data, VkImage image, VkForma return skip; } -static bool ValidateImageSubrangeLevelLayerCounts(layer_data *dev_data, const VkImageSubresourceRange &subresourceRange, - const char *func_name) { +bool ValidateImageSubrangeLevelLayerCounts(layer_data *dev_data, const VkImageSubresourceRange &subresourceRange, + const char *func_name) { bool skip = false; if (subresourceRange.levelCount == 0) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h index f346f75..d7d2cdd 100644 --- a/layers/core_validation_types.h +++ b/layers/core_validation_types.h @@ -767,8 +767,10 @@ bool ValidateImageMemoryIsValid(layer_data *dev_data, IMAGE_STATE *image_state, bool ValidateImageSampleCount(layer_data *dev_data, IMAGE_STATE *image_state, VkSampleCountFlagBits sample_count, const char *location, UNIQUE_VALIDATION_ERROR_CODE msgCode); bool ValidateImageUsageFlags(layer_data *dev_data, IMAGE_STATE const *image_state, VkFlags desired, VkBool32 strict, - int32_t const msgCode, char const *func_name, char const *usage_string); - + int32_t const msgCode, char const *func_name, char const *usage_string); +bool ValidateImageSubrangeLevelLayerCounts(layer_data *dev_data, const VkImageSubresourceRange &subresourceRange, + const char *func_name, UNIQUE_VALIDATION_ERROR_CODE layer_msg_code, + UNIQUE_VALIDATION_ERROR_CODE level_msg_code); // Prototypes for layer_data accessor functions. These should be in their own header file at some point PFN_vkGetPhysicalDeviceFormatProperties GetFormatPropertiesPointer(layer_data *); diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index b6815bb..be56105 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -1289,7 +1289,7 @@ VALIDATION_ERROR_01300~^~Y~^~Unknown~^~vkCmdBlitImage~^~For more information ref VALIDATION_ERROR_01301~^~N~^~Unknown~^~vkCmdBlitImage~^~For more information refer to Vulkan Spec Section '18.5. Image Copies with Scaling' which states 'regionCount must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkCmdBlitImage)~^~implicit VALIDATION_ERROR_01302~^~N~^~Unknown~^~vkCmdBlitImage~^~For more information refer to Vulkan Spec Section '18.5. Image Copies with Scaling' which states 'Each of commandBuffer, dstImage, and srcImage must have been created, allocated, or retrieved from the same VkDevice' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkCmdBlitImage)~^~implicit VALIDATION_ERROR_01303~^~N~^~Unknown~^~vkCmdBlitImage~^~For more information refer to Vulkan Spec Section '18.5. Image Copies with Scaling' which states 'The aspectMask member of srcSubresource and dstSubresource must match' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageBlit)~^~ -VALIDATION_ERROR_01304~^~N~^~Unknown~^~vkCmdBlitImage~^~For more information refer to Vulkan Spec Section '18.5. Image Copies with Scaling' which states 'The layerCount member of srcSubresource and dstSubresource must match' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageBlit)~^~ +VALIDATION_ERROR_01304~^~Y~^~Unknown~^~vkCmdBlitImage~^~For more information refer to Vulkan Spec Section '18.5. Image Copies with Scaling' which states 'The layerCount member of srcSubresource and dstSubresource must match' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageBlit)~^~ VALIDATION_ERROR_01305~^~N~^~Unknown~^~vkCmdBlitImage~^~For more information refer to Vulkan Spec Section '18.5. Image Copies with Scaling' which states 'If either of the calling commands srcImage or dstImage parameters are of VkImageType VK_IMAGE_TYPE_3D, the baseArrayLayer and layerCount members of both srcSubresource and dstSubresource must be 0 and 1, respectively' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageBlit)~^~ VALIDATION_ERROR_01306~^~N~^~Unknown~^~vkCmdBlitImage~^~For more information refer to Vulkan Spec Section '18.5. Image Copies with Scaling' which states 'The aspectMask member of srcSubresource must specify aspects present in the calling commands srcImage' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageBlit)~^~ VALIDATION_ERROR_01307~^~N~^~Unknown~^~vkCmdBlitImage~^~For more information refer to Vulkan Spec Section '18.5. Image Copies with Scaling' which states 'The aspectMask member of dstSubresource must specify aspects present in the calling commands dstImage' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageBlit)~^~