| 1325 | #endif |
| 1326 | |
| 1327 | void Demo::check_and_set_wsi_platform() { |
| 1328 | #if defined(VK_USE_PLATFORM_WAYLAND_KHR) |
| 1329 | if (wsi_platform == WsiPlatform::wayland || wsi_platform == WsiPlatform::auto_) { |
| 1330 | auto found = std::find_if(enabled_instance_extensions.begin(), enabled_instance_extensions.end(), |
| 1331 | [](const char *str) { return 0 == strcmp(str, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); }); |
| 1332 | if (found != enabled_instance_extensions.end()) { |
| 1333 | const char *error_msg = init_wayland_connection(); |
| 1334 | if (error_msg != NULL) { |
| 1335 | if (wsi_platform == WsiPlatform::wayland) { |
| 1336 | fprintf(stderr, "%s\nExiting ...\n", error_msg); |
| 1337 | fflush(stdout); |
| 1338 | exit(1); |
| 1339 | } |
| 1340 | } else { |
| 1341 | wsi_platform = WsiPlatform::wayland; |
| 1342 | return; |
| 1343 | } |
| 1344 | } |
| 1345 | } |
| 1346 | #endif |
| 1347 | #if defined(VK_USE_PLATFORM_XCB_KHR) |
| 1348 | if (wsi_platform == WsiPlatform::xcb || wsi_platform == WsiPlatform::auto_) { |
| 1349 | auto found = std::find_if(enabled_instance_extensions.begin(), enabled_instance_extensions.end(), |
| 1350 | [](const char *str) { return 0 == strcmp(str, VK_KHR_XCB_SURFACE_EXTENSION_NAME); }); |
| 1351 | if (found != enabled_instance_extensions.end()) { |
| 1352 | const char *error_msg = init_xcb_connection(); |
| 1353 | if (error_msg != NULL) { |
| 1354 | if (wsi_platform == WsiPlatform::xcb) { |
| 1355 | fprintf(stderr, "%s\nExiting ...\n", error_msg); |
| 1356 | fflush(stdout); |
| 1357 | exit(1); |
| 1358 | } |
| 1359 | } else { |
| 1360 | wsi_platform = WsiPlatform::xcb; |
| 1361 | return; |
| 1362 | } |
| 1363 | } |
| 1364 | } |
| 1365 | #endif |
| 1366 | #if defined(VK_USE_PLATFORM_XLIB_KHR) |
| 1367 | if (wsi_platform == WsiPlatform::xlib || wsi_platform == WsiPlatform::auto_) { |
| 1368 | auto found = std::find_if(enabled_instance_extensions.begin(), enabled_instance_extensions.end(), |
| 1369 | [](const char *str) { return 0 == strcmp(str, VK_KHR_XLIB_SURFACE_EXTENSION_NAME); }); |
| 1370 | if (found != enabled_instance_extensions.end()) { |
| 1371 | const char *error_msg = init_xlib_connection(); |
| 1372 | if (error_msg != NULL) { |
| 1373 | if (wsi_platform == WsiPlatform::xlib) { |
| 1374 | fprintf(stderr, "%s\nExiting ...\n", error_msg); |
| 1375 | fflush(stdout); |
| 1376 | exit(1); |
| 1377 | } |
| 1378 | } else { |
| 1379 | wsi_platform = WsiPlatform::xlib; |
| 1380 | return; |
| 1381 | } |
| 1382 | } |
| 1383 | } |
| 1384 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected