aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtney@LunarG.com>2015-07-15 17:45:38 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-07-17 10:05:24 -0600
commit3a35c82826feeadb5d2cd7b4c433d2189ef52591 (patch)
treee3f14c00f4701e97855ecbef22b122e444cf7bf9
parent556ee32901f093d5a708f25af428f52ed3cf7800 (diff)
downloadusermoji-3a35c82826feeadb5d2cd7b4c433d2189ef52591.tar.xz
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.
-rw-r--r--demos/cube.c12
1 files 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);