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 | 3b58daed93d76ac9ed32fa068de59075d6517c85 (patch) | |
| tree | d4992adc29a7db87d85c0a1a5d69fdc5850c353c /layers/buffer_validation.cpp | |
| parent | 78c9225b9ecc5235745a84f7bbc238448e899727 (diff) | |
| download | usermoji-3b58daed93d76ac9ed32fa068de59075d6517c85.tar.xz | |
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.
Diffstat (limited to 'layers/buffer_validation.cpp')
| -rw-r--r-- | layers/buffer_validation.cpp | 16 |
1 files changed, 16 insertions, 0 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); |
