Skip to content

Commit 80d6c28

Browse files
committed
VulkanWindow: added #ifdef workaround for accidental breaking API change in 1.4.324 minor version release of Vulkan SDK. Fixes #885.
1 parent d617e7a commit 80d6c28

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/ngscopeclient/VulkanWindow.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,19 @@ void VulkanWindow::Render()
502502
{
503503
auto result = m_swapchain->acquireNextImage(UINT64_MAX, **m_imageAcquiredSemaphores[m_semaphoreIndex], {});
504504
m_lastFrameIndex = m_frameIndex;
505-
m_frameIndex = result.second;
506-
if(result.first == vk::Result::eSuboptimalKHR)
505+
506+
//Accidental breaking API change in 1.4.324 Vulkan SDK release.
507+
//See https://github.com/KhronosGroup/Vulkan-Hpp/issues/2260
508+
//We can remove this first ifdef path when all supported platforms ship .324 and newer SDK
509+
#if (VK_HEADER_VERSION < 324)
510+
//Old SDK: std::pair<Result, uint32_t>
511+
m_frameIndex = result.second;
512+
if(result.first == vk::Result::eSuboptimalKHR)
513+
#else
514+
//New SD: vk::ResultValue<uint32_t>
515+
m_frameIndex = result.value;
516+
if(result.result == vk::Result::eSuboptimalKHR)
517+
#endif
507518
{
508519
// eSuboptimalKHR is actually a success code, meaning that although the image is suboptimal,
509520
// we *did* acquire the next image from the swapchain. Proceed to render the suboptimal frame

0 commit comments

Comments
 (0)