From 3411f92142e8e6a4e29e7f54eebebeec495f11bd Mon Sep 17 00:00:00 2001 From: Water Chika Date: Mon, 16 Dec 2024 09:04:05 +0000 Subject: Select physical device before create surface is platform is WSI Display --- cube/cube.c | 7 +++++-- cube/cube.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cube/cube.c b/cube/cube.c index 349bfc74..18fd5ec9 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 need gpu is 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 fafd1746..12e9e789 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -4098,7 +4098,8 @@ 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 need gpu is selected. + demo.select_physical_device(); break; #endif #if defined(VK_USE_PLATFORM_FUCHSIA) @@ -4113,7 +4114,9 @@ int main(int argc, char **argv) { demo.create_surface(); - demo.select_physical_device(); + if (demo.wsi_platform != WsiPlatform::display) { + demo.select_physical_device(); + } demo.init_vk_swapchain(); -- cgit v1.2.3