layers: Fix draw_state validation of descriptor updates with images
Earlier fix was broken b/c we didn't have format of swapchain images.
This fix adds the format to imageLayoutMap IMAGE_NODE struct, which contains all images created via vkCreateImage() as well as all swapchain images fetched via vkGetSwapchainImagesKHR().
This required enhancing the SWAPCHAIN_NODE to include the createInfo. Since this has a dangling ptr for queueIndices, added a constructor and destructor to that struct to handle allocation and clean-up of that ptr.
diff --git a/layers/draw_state.h b/layers/draw_state.h
index 45e8955..aeafce0 100755
--- a/layers/draw_state.h
+++ b/layers/draw_state.h
@@ -211,6 +211,7 @@
typedef struct _IMAGE_NODE {
VkImageLayout layout;
+ VkFormat format;
} IMAGE_NODE;
typedef struct _IMAGE_CMD_BUF_NODE {
@@ -526,5 +527,22 @@
} GLOBAL_CB_NODE;
typedef struct _SWAPCHAIN_NODE {
+ VkSwapchainCreateInfoKHR createInfo;
+ uint32_t* pQueueFamilyIndices;
std::vector<VkImage> images;
+ _SWAPCHAIN_NODE(const VkSwapchainCreateInfoKHR *pCreateInfo) :
+ createInfo(*pCreateInfo),
+ pQueueFamilyIndices(NULL)
+ {
+ if (pCreateInfo->queueFamilyIndexCount) {
+ pQueueFamilyIndices = new uint32_t[pCreateInfo->queueFamilyIndexCount];
+ memcpy(pQueueFamilyIndices, pCreateInfo->pQueueFamilyIndices, pCreateInfo->queueFamilyIndexCount*sizeof(uint32_t));
+ createInfo.pQueueFamilyIndices = pQueueFamilyIndices;
+ }
+ }
+ ~_SWAPCHAIN_NODE()
+ {
+ if (pQueueFamilyIndices)
+ delete pQueueFamilyIndices;
+ }
} SWAPCHAIN_NODE;