diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-07-19 17:39:34 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-07-22 14:18:15 -0600 |
| commit | 4c40aa8440dc37ae3885d616ef3c2fbba63b3c6d (patch) | |
| tree | bb2930764049210aef8bbff284695a1440082fb9 /layers/core_validation.cpp | |
| parent | 60dd2e7e50a13d5a4d7b2f17328d3cce5dcc2a8b (diff) | |
| download | usermoji-4c40aa8440dc37ae3885d616ef3c2fbba63b3c6d.tar.xz | |
layers: Fix image aspect checks
Previously validation required DS images to have both DEPTH and STENCIL
aspect bits set, but spec only requires that at least one is set.
Also, we weren't checking case of depth or stencil only formats, or
color format to make sure that correct aspect mask was set.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 980b92ee..3c5c87d8 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -8004,14 +8004,39 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui } } if (imageFound) { - if (vk_format_is_depth_and_stencil(format) && - (!(mem_barrier->subresourceRange.aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) || - !(mem_barrier->subresourceRange.aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT))) { - log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - DRAWSTATE_INVALID_BARRIER, "DS", "%s: Image is a depth and stencil format and thus must " - "have both VK_IMAGE_ASPECT_DEPTH_BIT and " - "VK_IMAGE_ASPECT_STENCIL_BIT set.", - funcName); + auto aspect_mask = mem_barrier->subresourceRange.aspectMask; + if (vk_format_is_depth_or_stencil(format)) { + if (vk_format_is_depth_and_stencil(format)) { + if (!(aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) && !(aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT)) { + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, + __LINE__, DRAWSTATE_INVALID_BARRIER, "DS", + "%s: Image is a depth and stencil format and thus must " + "have either one or both of VK_IMAGE_ASPECT_DEPTH_BIT and " + "VK_IMAGE_ASPECT_STENCIL_BIT set.", + funcName); + } + } else if (vk_format_is_depth_only(format)) { + if (!(aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT)) { + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, + __LINE__, DRAWSTATE_INVALID_BARRIER, "DS", "%s: Image is a depth-only format and thus must " + "have VK_IMAGE_ASPECT_DEPTH_BIT set.", + funcName); + } + } else { // stencil-only case + if (!(aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT)) { + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, + __LINE__, DRAWSTATE_INVALID_BARRIER, "DS", "%s: Image is a stencil-only format and thus must " + "have VK_IMAGE_ASPECT_STENCIL_BIT set.", + funcName); + } + } + } else { // image is a color format + if (!(aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT)) { + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + DRAWSTATE_INVALID_BARRIER, "DS", "%s: Image is a color format and thus must " + "have VK_IMAGE_ASPECT_COLOR_BIT set.", + funcName); + } } int layerCount = (mem_barrier->subresourceRange.layerCount == VK_REMAINING_ARRAY_LAYERS) ? 1 |
