From ef9fefcedd1f7f19dcb37e150c1c088885093bbf Mon Sep 17 00:00:00 2001 From: ziga-lunarg Date: Thu, 24 Aug 2023 17:25:48 +0200 Subject: [PATCH] tests: Test sync2 extension is found once --- tests/synchronization2_tests.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/synchronization2_tests.cpp b/tests/synchronization2_tests.cpp index 48cf16fa..fafc5a56 100644 --- a/tests/synchronization2_tests.cpp +++ b/tests/synchronization2_tests.cpp @@ -1435,3 +1435,24 @@ TEST_F(Sync2Test, SwapchainImage) { vk::DestroyImageView(m_device->device(), view, NULL); DestroySwapchain(); } + +TEST_F(Sync2Test, EnumerateDeviceExtensionProperties) { + TEST_DESCRIPTION("Verify the extension is found only once"); + if (!CheckSynchronization2SupportAndInitState()) { + GTEST_SKIP() << kSkipPrefix << " synchronization2 not supported, skipping test"; + } + + uint32_t propertyCount; + vk::EnumerateDeviceExtensionProperties(m_device->phy().handle(), nullptr, &propertyCount, nullptr); + std::vector props(propertyCount); + vk::EnumerateDeviceExtensionProperties(m_device->phy().handle(), nullptr, &propertyCount, props.data()); + + uint32_t count = 0; + for (const auto &p : props) { + if (strcmp(p.extensionName, "VK_KHR_synchronization2") == 0) { + ++count; + } + } + + ASSERT_EQ(count, 1); +}