layer: Avoid refs to pSwapchainImages in threading
vkGetSwapchainImagesKHR can return a non-zero count with a null
pSwapchainImages pointer. Avoid references to this pointer in the
thread safety validation.
Change-Id: I5f85ca95f0437c8a2b7706ff50621d5e06a717ce
diff --git a/scripts/thread_safety_generator.py b/scripts/thread_safety_generator.py
index 4918a83..9d682d9 100644
--- a/scripts/thread_safety_generator.py
+++ b/scripts/thread_safety_generator.py
@@ -542,6 +542,20 @@
c_VkCommandPoolContents.FinishWrite(commandPool);
}
+// GetSwapchainImages can return a non-zero count with a NULL pSwapchainImages pointer. Let's avoid crashes by ignoring
+// pSwapchainImages.
+void ThreadSafety::PreCallRecordGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount,
+ VkImage *pSwapchainImages) {
+ StartReadObject(device);
+ StartReadObject(swapchain);
+}
+
+void ThreadSafety::PostCallRecordGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount,
+ VkImage *pSwapchainImages) {
+ FinishReadObject(device);
+ FinishReadObject(swapchain);
+}
+
"""
@@ -830,7 +844,6 @@
# Command generation
def genCmd(self, cmdinfo, name, alias):
# Commands shadowed by interface functions and are not implemented
- # TODO: Many of these no longer need to be manually written routines. Winnow list.
special_functions = [
'vkCreateDevice',
'vkCreateInstance',
@@ -840,6 +853,7 @@
'vkDestroyCommandPool',
'vkAllocateDescriptorSets',
'vkQueuePresentKHR',
+ 'vkGetSwapchainImagesKHR',
]
if name == 'vkQueuePresentKHR' or (name in special_functions and self.source_file):
return