diff --git a/test/testvulkan.c b/test/testvulkan.c index e6c7bc432f..2fbac6ce25 100644 --- a/test/testvulkan.c +++ b/test/testvulkan.c @@ -307,6 +307,7 @@ static void findPhysicalDevice(void) uint32_t queueFamilyIndex; uint32_t deviceExtensionCount = 0; SDL_bool hasSwapchainExtension = SDL_FALSE; + SDL_bool supportsPresent; uint32_t i; VkPhysicalDevice physicalDevice = physicalDevices[physicalDeviceIndex]; @@ -354,6 +355,22 @@ static void findPhysicalDevice(void) quit(2); } if (supported) { + /* This check isn't necessary if you are able to check a + * VkSurfaceKHR like above, but just as a sanity check we do + * this here as part of testing the API. + * -flibit + */ + supportsPresent = SDL_Vulkan_GetPresentationSupport(vulkanContext->instance, physicalDevice, queueFamilyIndex); + if (!supportsPresent) { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetPresentationSupport(): %s\n", + SDL_GetError()); + quit(2); + } + vulkanContext->presentQueueFamilyIndex = queueFamilyIndex; if (queueFamiliesProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) { break; // use this queue because it can present and do graphics