From 411d3e7444e7c4125a51f0d6c98e85998d1df52c Mon Sep 17 00:00:00 2001 From: Water Chika Date: Mon, 16 Dec 2024 09:04:05 +0000 Subject: [PATCH 1/3] 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 3c6d32936..314f828a0 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 6c4f9b057..f8e28a8ec 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 need gpu is 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(); From 3eaf8c49e0f8f195bf4bdd1754f02b5e1876b207 Mon Sep 17 00:00:00 2001 From: Water Chika Date: Mon, 16 Dec 2024 19:08:14 +0000 Subject: [PATCH 2/3] Update cube/cube.c Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> --- cube/cube.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cube/cube.c b/cube/cube.c index 314f828a0..c0893bdbd 100644 --- a/cube/cube.c +++ b/cube/cube.c @@ -5073,7 +5073,7 @@ int main(int argc, char **argv) { #endif #if defined(VK_USE_PLATFORM_DISPLAY_KHR) case (WSI_PLATFORM_DISPLAY): - // select physical device because display surface creation need gpu is selected. + // select physical device because display surface creation needs a gpu to be selected. demo_select_physical_device(&demo); break; #endif From ee2661560cd6f995a68473e85945591e5239b082 Mon Sep 17 00:00:00 2001 From: Water Chika Date: Mon, 16 Dec 2024 19:08:53 +0000 Subject: [PATCH 3/3] Update cube/cube.cpp Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> --- cube/cube.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cube/cube.cpp b/cube/cube.cpp index f8e28a8ec..413dd2442 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -3826,7 +3826,7 @@ int main(int argc, char **argv) { #endif #if defined(VK_USE_PLATFORM_DISPLAY_KHR) case (WsiPlatform::display): - // select physical device because display surface creation need gpu is selected. + // select physical device because display surface creation needs a gpu to be selected. demo.select_physical_device(); break; #endif