tests: Fix failure in EnabledWsi test
For non-XCB displayserver builds the test was not returning causing
a failure.
Change-Id: I1f1aa577c393f0a9ae96c0c61828866a7be3fae6
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 78de111..ddf8d07 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -1648,17 +1648,18 @@
}
TEST_F(VkWsiEnabledLayerTest, TestEnabledWsi) {
- VkResult err;
- bool pass;
VkSurfaceKHR surface = VK_NULL_HANDLE;
+
#if defined(VK_USE_PLATFORM_XCB_KHR)
+ VkResult err;
+ bool pass;
VkSwapchainKHR swapchain = VK_NULL_HANDLE;
VkSwapchainCreateInfoKHR swapchain_create_info = {};
-// uint32_t swapchain_image_count = 0;
-// VkImage swapchain_images[1] = {VK_NULL_HANDLE};
-// uint32_t image_index = 0;
-// VkPresentInfoKHR present_info = {};
+ // uint32_t swapchain_image_count = 0;
+ // VkImage swapchain_images[1] = {VK_NULL_HANDLE};
+ // uint32_t image_index = 0;
+ // VkPresentInfoKHR present_info = {};
ASSERT_NO_FATAL_FAILURE(InitState());
@@ -1666,9 +1667,8 @@
// order to create a surface, testing all known errors in the process,
// before successfully creating a surface:
// First, try to create a surface without a VkXcbSurfaceCreateInfoKHR:
- m_errorMonitor->SetDesiredFailureMsg(
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "called with NULL pointer");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "called with NULL pointer");
err = vkCreateXcbSurfaceKHR(instance(), NULL, NULL, &surface);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
@@ -1678,15 +1678,13 @@
// VkXcbSurfaceCreateInfoKHR::sType:
VkXcbSurfaceCreateInfoKHR xcb_create_info = {};
xcb_create_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
- m_errorMonitor->SetDesiredFailureMsg(
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "called with the wrong value for");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "called with the wrong value for");
err = vkCreateXcbSurfaceKHR(instance(), &xcb_create_info, NULL, &surface);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
-
// Create a native window, and then correctly create a surface:
xcb_connection_t *connection;
xcb_screen_t *screen;
@@ -1728,8 +1726,7 @@
xcb_intern_atom_cookie_t cookie2 =
xcb_intern_atom(connection, 0, 16, "WM_DELETE_WINDOW");
- atom_wm_delete_window =
- xcb_intern_atom_reply(connection, cookie2, 0);
+ atom_wm_delete_window = xcb_intern_atom_reply(connection, cookie2, 0);
xcb_change_property(connection, XCB_PROP_MODE_REPLACE, xcb_window,
(*reply).atom, 4, 32, 1,
&(*atom_wm_delete_window).atom);
@@ -1743,8 +1740,6 @@
xcb_configure_window(connection, xcb_window,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, coords);
-
-
// Finally, try to correctly create a surface:
xcb_create_info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
xcb_create_info.pNext = NULL;
@@ -1755,8 +1750,6 @@
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
-
-
// Check if surface supports presentation:
// 1st, do so without having queried the queue families:
@@ -1768,26 +1761,26 @@
"function");
err = vkGetPhysicalDeviceSurfaceSupportKHR(gpu(), 0, surface, &supported);
pass = (err != VK_SUCCESS);
-// ASSERT_TRUE(pass);
-// m_errorMonitor->VerifyFound();
+ // ASSERT_TRUE(pass);
+ // m_errorMonitor->VerifyFound();
// Next, query a queue family index that's too large:
m_errorMonitor->SetDesiredFailureMsg(
VK_DEBUG_REPORT_ERROR_BIT_EXT,
"called with a queueFamilyIndex that is too large");
- err = vkGetPhysicalDeviceSurfaceSupportKHR(gpu(), 100000, surface, &supported);
+ err = vkGetPhysicalDeviceSurfaceSupportKHR(gpu(), 100000, surface,
+ &supported);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
// Finally, do so correctly:
-// FIXME: THIS ISN'T CORRECT--MUST QUERY UNTIL WE FIND A QUEUE FAMILY THAT'S SUPPORTED
+ // FIXME: THIS ISN'T CORRECT--MUST QUERY UNTIL WE FIND A QUEUE FAMILY THAT'S
+ // SUPPORTED
err = vkGetPhysicalDeviceSurfaceSupportKHR(gpu(), 0, surface, &supported);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
-
-
// Before proceeding, try to create a swapchain without having called
// vkGetPhysicalDeviceSurfaceCapabilitiesKHR():
swapchain_create_info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
@@ -1796,14 +1789,12 @@
m_errorMonitor->SetDesiredFailureMsg(
VK_DEBUG_REPORT_ERROR_BIT_EXT,
"called before calling vkGetPhysicalDeviceSurfaceCapabilitiesKHR().");
- err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info,
- NULL, &swapchain);
+ err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info, NULL,
+ &swapchain);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
-
-
// Get the surface capabilities:
VkSurfaceCapabilitiesKHR surface_capabilities;
@@ -1814,15 +1805,12 @@
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
-
-
// Get the surface formats:
uint32_t surface_format_count;
// First, try without a pointer to surface_format_count:
- m_errorMonitor->SetDesiredFailureMsg(
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "called with NULL pointer");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "called with NULL pointer");
vkGetPhysicalDeviceSurfaceFormatsKHR(gpu(), surface, NULL, NULL);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
@@ -1835,57 +1823,48 @@
"but no prior positive value has been seen for");
surface_format_count = 0;
vkGetPhysicalDeviceSurfaceFormatsKHR(
- gpu(),
- surface,
- &surface_format_count,
- (VkSurfaceFormatKHR *) &surface_format_count);
+ gpu(), surface, &surface_format_count,
+ (VkSurfaceFormatKHR *)&surface_format_count);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
// Next, correctly do a 1st try (with a NULL pointer to surface_formats):
- vkGetPhysicalDeviceSurfaceFormatsKHR(gpu(), surface,
- &surface_format_count, NULL);
+ vkGetPhysicalDeviceSurfaceFormatsKHR(gpu(), surface, &surface_format_count,
+ NULL);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
// Allocate memory for the correct number of VkSurfaceFormatKHR's:
- VkSurfaceFormatKHR *surface_formats =
- (VkSurfaceFormatKHR *)malloc(surface_format_count *
- sizeof(VkSurfaceFormatKHR));
+ VkSurfaceFormatKHR *surface_formats = (VkSurfaceFormatKHR *)malloc(
+ surface_format_count * sizeof(VkSurfaceFormatKHR));
// Next, do a 2nd try with surface_format_count being set too high:
surface_format_count += 5;
- m_errorMonitor->SetDesiredFailureMsg(
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "that is greater than the value");
- vkGetPhysicalDeviceSurfaceFormatsKHR(gpu(), surface,
- &surface_format_count,
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "that is greater than the value");
+ vkGetPhysicalDeviceSurfaceFormatsKHR(gpu(), surface, &surface_format_count,
surface_formats);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
// Finally, do a correct 1st and 2nd try:
- vkGetPhysicalDeviceSurfaceFormatsKHR(gpu(), surface,
- &surface_format_count, NULL);
+ vkGetPhysicalDeviceSurfaceFormatsKHR(gpu(), surface, &surface_format_count,
+ NULL);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
- vkGetPhysicalDeviceSurfaceFormatsKHR(gpu(), surface,
- &surface_format_count,
+ vkGetPhysicalDeviceSurfaceFormatsKHR(gpu(), surface, &surface_format_count,
surface_formats);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
-
-
// Get the surface present modes:
uint32_t surface_present_mode_count;
// First, try without a pointer to surface_format_count:
- m_errorMonitor->SetDesiredFailureMsg(
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "called with NULL pointer");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "called with NULL pointer");
vkGetPhysicalDeviceSurfacePresentModesKHR(gpu(), surface, NULL, NULL);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
@@ -1898,58 +1877,47 @@
"but no prior positive value has been seen for");
surface_present_mode_count = 0;
vkGetPhysicalDeviceSurfacePresentModesKHR(
- gpu(),
- surface,
- &surface_present_mode_count,
- (VkPresentModeKHR *) &surface_present_mode_count);
+ gpu(), surface, &surface_present_mode_count,
+ (VkPresentModeKHR *)&surface_present_mode_count);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
// Next, correctly do a 1st try (with a NULL pointer to surface_formats):
- vkGetPhysicalDeviceSurfacePresentModesKHR(gpu(), surface,
- &surface_present_mode_count,
- NULL);
+ vkGetPhysicalDeviceSurfacePresentModesKHR(
+ gpu(), surface, &surface_present_mode_count, NULL);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
// Allocate memory for the correct number of VkSurfaceFormatKHR's:
- VkPresentModeKHR *surface_present_modes =
- (VkPresentModeKHR *)malloc(surface_present_mode_count *
- sizeof(VkPresentModeKHR));
+ VkPresentModeKHR *surface_present_modes = (VkPresentModeKHR *)malloc(
+ surface_present_mode_count * sizeof(VkPresentModeKHR));
// Next, do a 2nd try with surface_format_count being set too high:
surface_present_mode_count += 5;
- m_errorMonitor->SetDesiredFailureMsg(
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "that is greater than the value");
- vkGetPhysicalDeviceSurfacePresentModesKHR(gpu(), surface,
- &surface_present_mode_count,
- surface_present_modes);
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "that is greater than the value");
+ vkGetPhysicalDeviceSurfacePresentModesKHR(
+ gpu(), surface, &surface_present_mode_count, surface_present_modes);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
// Finally, do a correct 1st and 2nd try:
- vkGetPhysicalDeviceSurfacePresentModesKHR(gpu(), surface,
- &surface_present_mode_count,
- NULL);
+ vkGetPhysicalDeviceSurfacePresentModesKHR(
+ gpu(), surface, &surface_present_mode_count, NULL);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
- vkGetPhysicalDeviceSurfacePresentModesKHR(gpu(), surface,
- &surface_present_mode_count,
- surface_present_modes);
+ vkGetPhysicalDeviceSurfacePresentModesKHR(
+ gpu(), surface, &surface_present_mode_count, surface_present_modes);
pass = (err == VK_SUCCESS);
ASSERT_TRUE(pass);
-
-
// Create a swapchain:
// First, try without a pointer to swapchain_create_info:
- m_errorMonitor->SetDesiredFailureMsg(
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "called with NULL pointer");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "called with NULL pointer");
err = vkCreateSwapchainKHR(m_device->device(), NULL, NULL, &swapchain);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
@@ -1958,11 +1926,10 @@
// Next, call with a non-NULL swapchain_create_info, that has the wrong
// sType:
swapchain_create_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
- m_errorMonitor->SetDesiredFailureMsg(
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "called with the wrong value for");
- err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info,
- NULL, &swapchain);
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "called with the wrong value for");
+ err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info, NULL,
+ &swapchain);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
@@ -1971,17 +1938,16 @@
swapchain_create_info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
swapchain_create_info.pNext = NULL;
swapchain_create_info.flags = 0;
- m_errorMonitor->SetDesiredFailureMsg(
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "called with NULL pointer");
- err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info,
- NULL, NULL);
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "called with NULL pointer");
+ err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info, NULL,
+ NULL);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
-// TODO: Enhance swapchain layer so that
-// swapchain_create_info.queueFamilyIndexCount is checked against something?
+ // TODO: Enhance swapchain layer so that
+ // swapchain_create_info.queueFamilyIndexCount is checked against something?
// Next, call with a queue family index that's too large:
uint32_t queueFamilyIndex[2] = {100000, 0};
@@ -1991,8 +1957,8 @@
m_errorMonitor->SetDesiredFailureMsg(
VK_DEBUG_REPORT_ERROR_BIT_EXT,
"called with a queueFamilyIndex that is too large");
- err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info,
- NULL, &swapchain);
+ err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info, NULL,
+ &swapchain);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
@@ -2004,8 +1970,8 @@
VK_DEBUG_REPORT_ERROR_BIT_EXT,
"but with a bad value(s) for pCreateInfo->queueFamilyIndexCount or "
"pCreateInfo->pQueueFamilyIndices).");
- err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info,
- NULL, &swapchain);
+ err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info, NULL,
+ &swapchain);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
@@ -2016,58 +1982,41 @@
m_errorMonitor->SetDesiredFailureMsg(
VK_DEBUG_REPORT_ERROR_BIT_EXT,
"called with a non-supported pCreateInfo->imageSharingMode (i.e.");
- err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info,
- NULL, &swapchain);
+ err = vkCreateSwapchainKHR(m_device->device(), &swapchain_create_info, NULL,
+ &swapchain);
pass = (err != VK_SUCCESS);
ASSERT_TRUE(pass);
m_errorMonitor->VerifyFound();
// Fix for the future:
-// FIXME: THIS ISN'T CORRECT--MUST QUERY UNTIL WE FIND A QUEUE FAMILY THAT'S SUPPORTED
+ // FIXME: THIS ISN'T CORRECT--MUST QUERY UNTIL WE FIND A QUEUE FAMILY THAT'S
+ // SUPPORTED
swapchain_create_info.queueFamilyIndexCount = 0;
queueFamilyIndex[0] = 0;
swapchain_create_info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
-// TODO: CONTINUE TESTING VALIDATION OF vkCreateSwapchainKHR() ...
-
-
-
+ // TODO: CONTINUE TESTING VALIDATION OF vkCreateSwapchainKHR() ...
// Get the images from a swapchain:
-
-
-
// Acquire an image from a swapchain:
-
-
-
// Present an image to a swapchain:
-
-
-
// Destroy the swapchain:
-
-
-// TODOs:
-//
-// - Try destroying the device without first destroying the swapchain
-//
-// - Try destroying the device without first destroying the surface
-//
-// - Try destroying the surface without first destroying the swapchain
-
+ // TODOs:
+ //
+ // - Try destroying the device without first destroying the swapchain
+ //
+ // - Try destroying the device without first destroying the surface
+ //
+ // - Try destroying the surface without first destroying the swapchain
// Destroy the surface:
vkDestroySurfaceKHR(instance(), surface, NULL);
-
// Tear down the window:
xcb_destroy_window(connection, xcb_window);
xcb_disconnect(connection);
#else // VK_USE_PLATFORM_XCB_KHR
- err = (surface == VK_NULL_HANDLE) ? VK_SUCCESS : VK_SUCCESS;
- pass = (err != VK_SUCCESS);
- ASSERT_TRUE(pass);
+ return;
#endif // VK_USE_PLATFORM_XCB_KHR
}