From 2d47da9c10ec86be03005ac339562dd0d3562d37 Mon Sep 17 00:00:00 2001 From: Ian Elliott Date: Mon, 13 Jul 2015 12:20:56 -0600 Subject: demos: Hack to get cube working--only 2 swap chain images. Other people have hard-coded the number of framebuffers, command buffers, etc. as being equal to DEMO_BUFFER_COUNT (i.e. 2). Without reworking all of that code, this demo won't work. Go with the flow for the time being, and hard-code the number of swap chain images as 2. --- demos/cube.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/demos/cube.c b/demos/cube.c index 7bdef0fd..828aaae2 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -681,6 +681,10 @@ static void demo_prepare_buffers(struct demo *demo) } } +#define WORK_AROUND_CODE +#ifdef WORK_AROUND_CODE + uint32_t desiredNumberOfSwapChainImages = DEMO_BUFFER_COUNT; +#else // WORK_AROUND_CODE // Determine the number of VkImage's to use in the swap chain (we desire to // own only 1 image at a time, besides the images being displayed and // queued for display): @@ -691,6 +695,7 @@ static void demo_prepare_buffers(struct demo *demo) // Application must settle for fewer images than desired: desiredNumberOfSwapChainImages = surfProperties->maxImageCount; } +#endif // WORK_AROUND_CODE VkSurfaceTransformFlagBitsWSI preTransform; if (surfProperties->supportedTransforms & VK_SURFACE_TRANSFORM_NONE_BIT_WSI) { @@ -733,8 +738,12 @@ static void demo_prepare_buffers(struct demo *demo) &swapChainImagesSize, swapChainImages); assert(!err); +#ifdef WORK_AROUND_CODE + demo->swapChainImageCount = DEMO_BUFFER_COUNT; +#else // WORK_AROUND_CODE // The number of images within the swap chain is determined based on the size of the info returned demo->swapChainImageCount = swapChainImagesSize / sizeof(VkSwapChainImagePropertiesWSI); +#endif // WORK_AROUND_CODE demo->buffers = (SwapChainBuffers*)malloc(sizeof(SwapChainBuffers)*demo->swapChainImageCount); assert(demo->buffers); -- cgit v1.2.3