Skip to content

Commit

Permalink
Merge pull request #2159 from billhollings/no-headless-sub-optimal
Browse files Browse the repository at this point in the history
Don't return VK_SUBOPTIMAL_KHR for headless surfaces.
  • Loading branch information
billhollings authored Feb 13, 2024
2 parents a62cada + 9c812da commit 37361cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@
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) &&
Expand Down

0 comments on commit 37361cc

Please sign in to comment.