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/buffer_validation.cpp | |
| 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/buffer_validation.cpp')
| -rw-r--r-- | layers/buffer_validation.cpp | 20 |
1 files changed, 20 insertions, 0 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; } |
