From 3a35c82826feeadb5d2cd7b4c433d2189ef52591 Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Wed, 15 Jul 2015 17:45:38 -0600 Subject: cube: Fill in pPlatformWindow after you have a window demo_init_vk(), which sets the surface_description.pPlatformWindow was getting called before the window was created so surface_description.pPlatformWindow was always NULL. I added a new demo_init_vk_wsi() which splits demo_init_vk() in two so that the window is created before surface_description.pPlatformWindow is assigned. --- demos/cube.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/demos/cube.c b/demos/cube.c index ad49f9d8..3b418040 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -2383,9 +2383,15 @@ static void demo_init_vk(struct demo *demo) assert(demo->queue_count >= 1); demo->queue_props = (VkPhysicalDeviceQueueProperties *) malloc(demo->queue_count * sizeof(VkPhysicalDeviceQueueProperties)); - err = vkGetPhysicalDeviceQueueProperties(demo->gpu, queue_count, demo->queue_props); + err = vkGetPhysicalDeviceQueueProperties(demo->gpu, demo->queue_count, demo->queue_props); assert(!err); - assert(queue_count >= 1); + assert(demo->queue_count >= 1); +} + +static void demo_init_vk_wsi(struct demo *demo) +{ + VkResult err; + uint32_t i; // Construct the WSI surface description: demo->surface_description.sType = VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI; @@ -2598,6 +2604,7 @@ int WINAPI WinMain(HINSTANCE hInstance, demo.connection = hInstance; strncpy(demo.name, "cube", APP_NAME_STR_LEN); demo_create_window(&demo); + demo_init_vk_wsi(&demo); demo_prepare(&demo); @@ -2629,6 +2636,7 @@ int main(int argc, char **argv) demo_init(&demo, argc, argv); demo_create_window(&demo); + demo_init_vk_wsi(&demo); demo_prepare(&demo); demo_run(&demo); -- cgit v1.2.3