From 62bfec8442c6949b6abfc6742a41239f6528c67d Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 18 Nov 2022 12:30:04 +0000 Subject: [PATCH] Test empty submits are properly processed --- util/test/demos/vk/vk_parameter_zoo.cpp | 27 +++++++++++++++++++++ util/test/tests/Vulkan/VK_Parameter_Zoo.py | 28 ++++++++++++++++++---- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/util/test/demos/vk/vk_parameter_zoo.cpp b/util/test/demos/vk/vk_parameter_zoo.cpp index 6bca788e2..643b57d0f 100644 --- a/util/test/demos/vk/vk_parameter_zoo.cpp +++ b/util/test/demos/vk/vk_parameter_zoo.cpp @@ -253,6 +253,7 @@ void main() optDevExts.push_back(VK_KHR_BIND_MEMORY_2_EXTENSION_NAME); optDevExts.push_back(VK_KHR_MULTIVIEW_EXTENSION_NAME); optDevExts.push_back(VK_KHR_MAINTENANCE2_EXTENSION_NAME); + optDevExts.push_back(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME); VulkanGraphicsTest::Prepare(argc, argv); @@ -309,6 +310,17 @@ void main() multiview.pNext = (void *)devInfoNext; devInfoNext = &multiview; } + + static VkPhysicalDeviceSynchronization2FeaturesKHR sync2Features = { + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR, + }; + + if(hasExt(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME)) + { + sync2Features.synchronization2 = VK_TRUE; + sync2Features.pNext = (void *)devInfoNext; + devInfoNext = &sync2Features; + } } int main() @@ -1653,6 +1665,21 @@ void main() Submit(3, 4, {cmd}); } + // make some empty submits + + setMarker(queue, "before_empty"); + + { + VkSubmitInfo submit = vkh::SubmitInfo({}); + CHECK_VKR(vkQueueSubmit(queue, 1, &submit, VK_NULL_HANDLE)); + } + if(hasExt(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME)) + { + VkSubmitInfo2KHR submit = {VK_STRUCTURE_TYPE_SUBMIT_INFO_2_KHR}; + CHECK_VKR(vkQueueSubmit2KHR(queue, 1, &submit, VK_NULL_HANDLE)); + } + setMarker(queue, "after_empty"); + Present(); } diff --git a/util/test/tests/Vulkan/VK_Parameter_Zoo.py b/util/test/tests/Vulkan/VK_Parameter_Zoo.py index c2827d5d7..a1ef13bb5 100644 --- a/util/test/tests/Vulkan/VK_Parameter_Zoo.py +++ b/util/test/tests/Vulkan/VK_Parameter_Zoo.py @@ -197,8 +197,28 @@ class VK_Parameter_Zoo(rdtest.TestCase): raise rdtest.TestFailureException( "Expected validSampler to be at binding slot 0 in immutable action") - # Check for resource leaks - if len(self.controller.GetStructuredFile().chunks) > 500: - raise rdtest.TestFailureException( - "Too many chunks found: {}".format(len(self.controller.GetStructuredFile().chunks))) + sdfile = self.controller.GetStructuredFile() + + # Check for resource leaks + if len(sdfile.chunks) > 500: + raise rdtest.TestFailureException( + "Too many chunks found: {}".format(len(sdfile.chunks))) + + action = self.find_action("before_empty") + action = self.get_action(action.eventId+1) + self.check("vkQueueSubmit" in action.GetName(sdfile)) + a = action.GetName(sdfile) + action = self.get_action(action.eventId+1) + self.check("vkQueueSubmit" in action.GetName(sdfile)) + self.check("No Command Buffers" in action.GetName(sdfile)) + self.check(a != action.GetName(sdfile)) + + action = self.get_action(action.eventId+1) + if "after_empty" not in action.GetName(sdfile): + self.check("vkQueueSubmit2" in action.GetName(sdfile)) + a = action.GetName(sdfile) + action = self.get_action(action.eventId + 1) + self.check("vkQueueSubmit2" in action.GetName(sdfile)) + self.check("No Command Buffers" in action.GetName(sdfile)) + self.check(a != action.GetName(sdfile))