diff --git a/cube/cube.c b/cube/cube.c index 3c6d32936..c0893bdbd 100644 --- a/cube/cube.c +++ b/cube/cube.c @@ -5073,12 +5073,15 @@ int main(int argc, char **argv) { #endif #if defined(VK_USE_PLATFORM_DISPLAY_KHR) case (WSI_PLATFORM_DISPLAY): - // nothing to do here + // select physical device because display surface creation needs a gpu to be selected. + demo_select_physical_device(&demo); break; #endif } demo_create_surface(&demo); - demo_select_physical_device(&demo); + if (demo.wsi_platform != WSI_PLATFORM_DISPLAY) { + demo_select_physical_device(&demo); + } demo_init_vk_swapchain(&demo); diff --git a/cube/cube.cpp b/cube/cube.cpp index 6c4f9b057..413dd2442 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -3826,14 +3826,17 @@ int main(int argc, char **argv) { #endif #if defined(VK_USE_PLATFORM_DISPLAY_KHR) case (WsiPlatform::display): - // nothing to do here + // select physical device because display surface creation needs a gpu to be selected. + demo.select_physical_device(); break; #endif } demo.create_surface(); - demo.select_physical_device(); + if (demo.wsi_platform != WsiPlatform::display) { + demo.select_physical_device(); + } demo.init_vk_swapchain();