diff options
| author | Tobin Ehlis <tobine@google.com> | 2017-11-30 13:47:11 -0700 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2017-12-06 09:25:20 -0700 |
| commit | 7132dce959956ed52de3be69d7997aed4dfa5238 (patch) | |
| tree | 9b5f160dfacb6602a83e804805e5707bd6855f88 /layers | |
| parent | 7e46a5a0f95dc143b092ecf92e811b1d499b64d5 (diff) | |
| download | usermoji-7132dce959956ed52de3be69d7997aed4dfa5238.tar.xz | |
layers:Add image checks for DS image being cleared
Adding checks for two new VUIDs related to vkCmdClearDepthStencilImage
function. Making sure that the image being cleared supports use as a
transfer destination and that the image was created with the usage bit
VK_IMAGE_USAGE_TRANSFER_DST_BIT.
Diffstat (limited to 'layers')
| -rw-r--r-- | layers/buffer_validation.cpp | 20 | ||||
| -rw-r--r-- | layers/vk_validation_error_database.txt | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 77314a2a..d69917bd 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -1100,6 +1100,26 @@ bool PreCallValidateCmdClearDepthStencilImage(layer_data *device_data, VkCommand HandleToUint64(image), __LINE__, VALIDATION_ERROR_18a0001c, "IMAGE", "%s. %s", str, validation_error_map[VALIDATION_ERROR_18a0001c]); } + if (VK_IMAGE_USAGE_TRANSFER_DST_BIT != (VK_IMAGE_USAGE_TRANSFER_DST_BIT & image_state->createInfo.usage)) { + char const str[] = + "vkCmdClearDepthStencilImage() called with an image that was not created with the VK_IMAGE_USAGE_TRANSFER_DST_BIT " + "set."; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(image), __LINE__, VALIDATION_ERROR_18a00012, "IMAGE", "%s. %s", str, + validation_error_map[VALIDATION_ERROR_18a00012]); + } + VkFormatProperties props = GetFormatProperties(device_data, image_state->createInfo.format); + VkImageTiling tiling = image_state->createInfo.tiling; + VkFormatFeatureFlags flags = (tiling == VK_IMAGE_TILING_LINEAR ? props.linearTilingFeatures : props.optimalTilingFeatures); + if ((GetDeviceExtensions(device_data)->vk_khr_maintenance1) && + (VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR != (flags & VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR))) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(image), __LINE__, VALIDATION_ERROR_18a00010, "IMAGE", + "vkCmdClearDepthStencilImage() called with an image of format %s and tiling %s that does not support " + "VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR. %s", + string_VkFormat(image_state->createInfo.format), string_VkImageTiling(image_state->createInfo.tiling), + validation_error_map[VALIDATION_ERROR_18a00010]); + } } return skip; } diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index 441aa549..40c6f38e 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -1852,8 +1852,8 @@ VALIDATION_ERROR_18810e01~^~Y~^~Unknown~^~vkCmdClearColorImage~^~VUID-vkCmdClear VALIDATION_ERROR_18820601~^~Y~^~Unknown~^~vkCmdClearColorImage~^~VUID-vkCmdClearColorImage-pRanges-parameter~^~core~^~The spec valid usage text states 'pRanges must be a valid pointer to an array of rangeCount valid VkImageSubresourceRange structures' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearColorImage-pRanges-parameter)~^~implicit VALIDATION_ERROR_1882a41b~^~Y~^~Unknown~^~vkCmdClearColorImage~^~VUID-vkCmdClearColorImage-rangeCount-arraylength~^~core~^~The spec valid usage text states 'rangeCount must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearColorImage-rangeCount-arraylength)~^~implicit VALIDATION_ERROR_18a00009~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-commonparent~^~core~^~The spec valid usage text states 'Both of commandBuffer, and image must have been created, allocated, or retrieved from the same VkDevice' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-commonparent)~^~implicit -VALIDATION_ERROR_18a00010~^~N~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-image-00008~^~(VK_KHR_maintenance1)~^~The spec valid usage text states 'image must use a format that supports VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR, which is indicated by VkFormatProperties::linearTilingFeatures (for linearly tiled images) or VkFormatProperties::optimalTilingFeatures (for optimally tiled images) - as returned by vkGetPhysicalDeviceFormatProperties' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-image-00008)~^~ -VALIDATION_ERROR_18a00012~^~N~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-image-00009~^~core~^~The spec valid usage text states 'image must have been created with VK_IMAGE_USAGE_TRANSFER_DST_BIT usage flag' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-image-00009)~^~ +VALIDATION_ERROR_18a00010~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-image-00008~^~(VK_KHR_maintenance1)~^~The spec valid usage text states 'image must use a format that supports VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR, which is indicated by VkFormatProperties::linearTilingFeatures (for linearly tiled images) or VkFormatProperties::optimalTilingFeatures (for optimally tiled images) - as returned by vkGetPhysicalDeviceFormatProperties' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-image-00008)~^~ +VALIDATION_ERROR_18a00012~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-image-00009~^~core~^~The spec valid usage text states 'image must have been created with VK_IMAGE_USAGE_TRANSFER_DST_BIT usage flag' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-image-00009)~^~ VALIDATION_ERROR_18a00014~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-image-00010~^~core~^~The spec valid usage text states 'If image is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-image-00010)~^~ VALIDATION_ERROR_18a00016~^~Y~^~InvalidImageLayout~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-imageLayout-00011~^~core~^~The spec valid usage text states 'imageLayout must specify the layout of the image subresource ranges of image specified in pRanges at the time this command is executed on a VkDevice' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-imageLayout-00011)~^~ VALIDATION_ERROR_18a00017~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-renderpass~^~core~^~The spec valid usage text states 'This command must only be called outside of a render pass instance' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-renderpass)~^~implicit |
