Merge pull request #2159 from billhollings/no-headless-sub-optimal

Don't return VK_SUBOPTIMAL_KHR for headless surfaces.
This commit is contained in:
Bill Hollings 2024-02-12 19:46:53 -05:00 committed by GitHub
commit 37361ccd55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -128,11 +128,11 @@ VkResult MVKSwapchain::getSurfaceStatus() {
return VK_SUCCESS;
}
// This swapchain is optimally sized for the surface if the app has specified
// deliberate swapchain scaling, or the surface extent has not changed since the
// swapchain was created, and the surface will not need to be scaled when composited.
// This swapchain is optimally sized for the surface if the app has specified deliberate
// swapchain scaling, or if the surface is headless, or if the surface extent has not changed
// since the swapchain was created, and the surface will not need to be scaled when composited.
bool MVKSwapchain::hasOptimalSurface() {
if (_isDeliberatelyScaled) { return true; }
if (_isDeliberatelyScaled || isHeadless()) { return true; }
VkExtent2D surfExtent = _surface->getExtent();
return (mvkVkExtent2DsAreEqual(surfExtent, _imageExtent) &&