diff --git a/runtime/shims/dxgi_swapchain.h b/runtime/shims/dxgi_swapchain.h index 1a3650208f..f2e6693d37 100644 --- a/runtime/shims/dxgi_swapchain.h +++ b/runtime/shims/dxgi_swapchain.h @@ -582,7 +582,16 @@ class VulkanSwapchain { ci.oldSwapchain = swapchain_; VkSwapchainKHR next = VK_NULL_HANDLE; - if (observe(fn_.create_swapchain(device_, &ci, nullptr, &next), "vkCreateSwapchainKHR (DXGI)") != VK_SUCCESS) { + if (const VkResult created = observe(fn_.create_swapchain(device_, &ci, nullptr, &next), + "vkCreateSwapchainKHR (DXGI)"); + created != VK_SUCCESS) { + // observe() speaks only for a lost device, so a swapchain the surface refuses used to vanish here and + // resurface later as "present failed", which names the symptom rather than the cause. Name the request. + std::fprintf(stderr, + "[rt] d3d12: vkCreateSwapchainKHR failed (VkResult %d): format %d, colour space %d, %ux%u, " + "present mode %d, images %u, composite alpha %d\n", + int(created), int(ci.imageFormat), int(ci.imageColorSpace), ci.imageExtent.width, + ci.imageExtent.height, int(ci.presentMode), ci.minImageCount, int(ci.compositeAlpha)); // oldSwapchain is retired even when the call fails: it can neither present nor be passed as // oldSwapchain again (VUID-VkSwapchainCreateInfoKHR-oldSwapchain-01933). Drop it and its buffers, as a // failed ResizeBuffers leaves the host's swap chain with none.