diff options
| author | Ian Elliott <ian@lunarg.com> | 2015-07-13 12:20:56 -0600 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-07-17 10:05:22 -0600 |
| commit | 2d47da9c10ec86be03005ac339562dd0d3562d37 (patch) | |
| tree | 26ad65b7f58418fd9932fa73540c4cf2df1e3372 | |
| parent | c0bb127c15882098b791a4d69dca51cd1cfba21c (diff) | |
| download | usermoji-2d47da9c10ec86be03005ac339562dd0d3562d37.tar.xz | |
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.
| -rw-r--r-- | demos/cube.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); |
