diff options
author | Tobin Ehlis <tobine@google.com> | 2017-04-26 16:51:48 -0600 |
---|---|---|
committer | Tobin Ehlis <tobine@google.com> | 2017-04-27 00:41:29 -0600 |
commit | c7455116cef9c14f8405aae43bc0247f2c256f96 (patch) | |
tree | 4f8e26eb4fcb9b37b4c5b81b6381c96fe03a5735 | |
parent | f889e5e31016e31cbce9e057fd2513ba4c686101 (diff) |
layers:Add barrier imageAspect check for DS image
Fixes #1703
Add validation check to make sure that both depth & stencil aspects of
DS images are transitioned in image memory barrier.
-rw-r--r-- | layers/buffer_validation.cpp | 16 | ||||
-rw-r--r-- | layers/vk_validation_error_database.txt | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 0cd9f36f..ec8016f5 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -473,6 +473,22 @@ bool ValidateBarriersToImages(layer_data *device_data, VkCommandBuffer cmdBuffer if (!img_barrier) continue; VkImageCreateInfo *image_create_info = &(GetImageState(device_data, img_barrier->image)->createInfo); + // For a Depth/Stencil image both aspects MUST be set + if (FormatIsDepthAndStencil(image_create_info->format)) { + auto const aspect_mask = img_barrier->subresourceRange.aspectMask; + auto const ds_mask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; + if ((aspect_mask & ds_mask) != (ds_mask)) { + skip |= + log_msg(core_validation::GetReportData(device_data), VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, reinterpret_cast<const uint64_t &>(img_barrier->image), __LINE__, + VALIDATION_ERROR_00302, "DS", + "%s: Image barrier 0x%p references image 0x%" PRIx64 + " of format %s that must have the depth and stencil aspects set, but its " + "aspectMask is 0x%" PRIx32 ". %s", + func_name, img_barrier, reinterpret_cast<const uint64_t &>(img_barrier->image), + string_VkFormat(image_create_info->format), aspect_mask, validation_error_map[VALIDATION_ERROR_00302]); + } + } uint32_t level_count = ResolveRemainingLevels(&img_barrier->subresourceRange, image_create_info->mipLevels); uint32_t layer_count = ResolveRemainingLayers(&img_barrier->subresourceRange, image_create_info->arrayLayers); diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index 5076422a..c991b21c 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -293,7 +293,7 @@ VALIDATION_ERROR_00295~^~N~^~Unknown~^~vkCmdPipelineBarrier~^~For more informati VALIDATION_ERROR_00296~^~N~^~Unknown~^~vkCmdPipelineBarrier~^~For more information refer to Vulkan Spec Section '6.7.3. Image Memory Barriers' which states 'oldLayout must be VK_IMAGE_LAYOUT_UNDEFINED or the current layout of the image subresources affected by the barrier' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkImageMemoryBarrier)~^~ VALIDATION_ERROR_00297~^~N~^~Unknown~^~vkCmdPipelineBarrier~^~For more information refer to Vulkan Spec Section '6.7.3. Image Memory Barriers' which states 'newLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or VK_IMAGE_LAYOUT_PREINITIALIZED' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkImageMemoryBarrier)~^~ VALIDATION_ERROR_00300~^~N~^~Unknown~^~vkCmdPipelineBarrier~^~For more information refer to Vulkan Spec Section '6.7.3. Image Memory Barriers' which states 'If image was created with a sharing mode of VK_SHARING_MODE_EXCLUSIVE, and srcQueueFamilyIndex and dstQueueFamilyIndex are valid queue families, at least one of them must be the same as the family of the queue that will execute this barrier' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkImageMemoryBarrier)~^~ -VALIDATION_ERROR_00302~^~N~^~Unknown~^~vkCmdPipelineBarrier~^~For more information refer to Vulkan Spec Section '6.7.3. Image Memory Barriers' which states 'If image has a depth/stencil format with both depth and stencil components, then aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkImageMemoryBarrier)~^~ +VALIDATION_ERROR_00302~^~Y~^~Unknown~^~vkCmdPipelineBarrier~^~For more information refer to Vulkan Spec Section '6.7.3. Image Memory Barriers' which states 'If image has a depth/stencil format with both depth and stencil components, then aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkImageMemoryBarrier)~^~ VALIDATION_ERROR_00303~^~Y~^~InvalidBarriers~^~vkCmdPipelineBarrier~^~For more information refer to Vulkan Spec Section '6.7.3. Image Memory Barriers' which states 'If either oldLayout or newLayout is VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL then image must have been created with VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT set' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkImageMemoryBarrier)~^~ VALIDATION_ERROR_00304~^~Y~^~InvalidBarriers~^~vkCmdPipelineBarrier~^~For more information refer to Vulkan Spec Section '6.7.3. Image Memory Barriers' which states 'If either oldLayout or newLayout is VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL then image must have been created with VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT set' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkImageMemoryBarrier)~^~ VALIDATION_ERROR_00305~^~Y~^~InvalidBarriers~^~vkCmdPipelineBarrier~^~For more information refer to Vulkan Spec Section '6.7.3. Image Memory Barriers' which states 'If either oldLayout or newLayout is VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL then image must have been created with VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT set' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkImageMemoryBarrier)~^~ |