layers:Add image barrier image check
authorTobin Ehlis <tobine@google.com>
Thu, 20 Jul 2017 14:31:01 +0000 (08:31 -0600)
committerTobin Ehlis <tobine@google.com>
Mon, 24 Jul 2017 21:28:18 +0000 (15:28 -0600)
This is VALIDATION_ERROR_1b800930.
Make sure that image in VkImageBarrier matches one of the images in the
current framebuffer.

layers/core_validation.cpp
layers/vk_validation_error_database.txt

index ad647e8..36d3f34 100644 (file)
@@ -6247,6 +6247,24 @@ static bool ValidateRenderPassPipelineBarriers(layer_data *device_data, const ch
                                 funcName, i, img_dst_access_mask, sub_dst_access_mask, cb_state->activeSubpass, rp_handle,
                                 validation_error_map[VALIDATION_ERROR_1b800930]);
             }
+            // Verify that a framebuffer image matches barrier image
+            const auto &fb_state = GetFramebufferState(device_data, cb_state->activeFramebuffer);
+            const auto img_bar_image = image_barriers[i].image;
+            bool image_match = false;
+            for (const auto &fb_attach : fb_state->attachments) {
+                if (img_bar_image == fb_attach.image) {
+                    image_match = true;
+                }
+            }
+            if (!image_match) {
+                auto const fb_handle = HandleToUint64(fb_state->framebuffer);
+                skip |=
+                    log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT,
+                            fb_handle, __LINE__, VALIDATION_ERROR_1b800936, "CORE",
+                            "%s: Barrier pImageMemoryBarriers[%d].image (0x%" PRIx64
+                            ") does not match an image from the current framebuffer (0x%" PRIx64 "). %s",
+                            funcName, i, HandleToUint64(img_bar_image), fb_handle, validation_error_map[VALIDATION_ERROR_1b800936]);
+            }
         }
         if (sub_dep.dependencyFlags != dependency_flags) {
             skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
index 5e73f4f..0a05b50 100644 (file)
@@ -2112,7 +2112,7 @@ VALIDATION_ERROR_1b80092e~^~Y~^~RenderPassBarrierConflicts~^~vkCmdPipelineBarrie
 VALIDATION_ERROR_1b800930~^~Y~^~RenderPassBarrierConflicts~^~vkCmdPipelineBarrier~^~VUID-vkCmdPipelineBarrier-dstAccessMask-01176~^~core~^~The spec valid usage text states 'If vkCmdPipelineBarrier is called within a render pass instance, the dstAccessMask of any element of pMemoryBarriers or pImageMemoryBarriers must contain a subset of the bit values the dstAccessMask member of that instance of VkSubpassDependency' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdPipelineBarrier-dstAccessMask-01176)~^~
 VALIDATION_ERROR_1b800932~^~Y~^~RenderPassBarrierConflicts~^~vkCmdPipelineBarrier~^~VUID-vkCmdPipelineBarrier-dependencyFlags-01177~^~core~^~The spec valid usage text states 'If vkCmdPipelineBarrier is called within a render pass instance, dependencyFlags must be equal to the dependencyFlags member of that instance of VkSubpassDependency' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdPipelineBarrier-dependencyFlags-01177)~^~
 VALIDATION_ERROR_1b800934~^~Y~^~RenderPassBarrierConflicts~^~vkCmdPipelineBarrier~^~VUID-vkCmdPipelineBarrier-bufferMemoryBarrierCount-01178~^~core~^~The spec valid usage text states 'If vkCmdPipelineBarrier is called within a render pass instance, bufferMemoryBarrierCount must be 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdPipelineBarrier-bufferMemoryBarrierCount-01178)~^~
-VALIDATION_ERROR_1b800936~^~N~^~Unknown~^~vkCmdPipelineBarrier~^~VUID-vkCmdPipelineBarrier-image-01179~^~core~^~The spec valid usage text states 'If vkCmdPipelineBarrier is called within a render pass instance, the image member of any element of pImageMemoryBarriers must be equal to one of the elements of pAttachments that the current framebuffer was created with, that is also referred to by one of the elements of the pColorAttachments, pResolveAttachments or pDepthStencilAttachment members of the VkSubpassDescription instance that the current subpass was created with' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdPipelineBarrier-image-01179)~^~
+VALIDATION_ERROR_1b800936~^~Y~^~Unknown~^~vkCmdPipelineBarrier~^~VUID-vkCmdPipelineBarrier-image-01179~^~core~^~The spec valid usage text states 'If vkCmdPipelineBarrier is called within a render pass instance, the image member of any element of pImageMemoryBarriers must be equal to one of the elements of pAttachments that the current framebuffer was created with, that is also referred to by one of the elements of the pColorAttachments, pResolveAttachments or pDepthStencilAttachment members of the VkSubpassDescription instance that the current subpass was created with' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdPipelineBarrier-image-01179)~^~
 VALIDATION_ERROR_1b800938~^~N~^~Unknown~^~vkCmdPipelineBarrier~^~VUID-vkCmdPipelineBarrier-oldLayout-01180~^~core~^~The spec valid usage text states 'If vkCmdPipelineBarrier is called within a render pass instance, the oldLayout and newLayout members of any element of pImageMemoryBarriers must be equal to the layout member of an element of the pColorAttachments, pResolveAttachments or pDepthStencilAttachment members of the VkSubpassDescription instance that the current subpass was created with, that refers to the same image' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdPipelineBarrier-oldLayout-01180)~^~
 VALIDATION_ERROR_1b80093a~^~Y~^~InvalidBarriers~^~vkCmdPipelineBarrier~^~VUID-vkCmdPipelineBarrier-oldLayout-01181~^~core~^~The spec valid usage text states 'If vkCmdPipelineBarrier is called within a render pass instance, the oldLayout and newLayout members of an element of pImageMemoryBarriers must be equal' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdPipelineBarrier-oldLayout-01181)~^~
 VALIDATION_ERROR_1b80093c~^~N~^~Unknown~^~vkCmdPipelineBarrier~^~VUID-vkCmdPipelineBarrier-srcQueueFamilyIndex-01182~^~core~^~The spec valid usage text states 'If vkCmdPipelineBarrier is called within a render pass instance, the srcQueueFamilyIndex and dstQueueFamilyIndex members of any element of pImageMemoryBarriers must be VK_QUEUE_FAMILY_IGNORED' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdPipelineBarrier-srcQueueFamilyIndex-01182)~^~