Skip to content

Commit

Permalink
[d3d9,d3d11] recreate swapchain on VK_SUBOPTIMAL_KHR
Browse files Browse the repository at this point in the history
The vulkan wayland wsi returns suboptimal when the window is
fullscreened and not directly scanned out, and there are modifiers
available that would allow the window to be directly scanned out.
Recreate the swapchain if we receive suboptimal result.

This allows us recreate the swapchain to use a modifier that allows
direct scan-out under winewayland on wayland compositors.
  • Loading branch information
llyyr authored and nv-nfreybler committed Nov 14, 2024
1 parent edf9ae6 commit 0f7c200
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/d3d11/d3d11_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,17 @@ namespace dxvk {

VkResult status = m_presenter->acquireNextImage(sync, imageIndex);

while (status != VK_SUCCESS && status != VK_SUBOPTIMAL_KHR) {
while (status != VK_SUCCESS) {
RecreateSwapChain(m_vsync);

if (!m_presenter->hasSwapChain())
return DXGI_STATUS_OCCLUDED;

info = m_presenter->info();
status = m_presenter->acquireNextImage(sync, imageIndex);

if (status == VK_SUBOPTIMAL_KHR)
break;
}

// Resolve back buffer if it is multisampled. We
Expand Down
7 changes: 5 additions & 2 deletions src/d3d9/d3d9_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,14 +1155,17 @@ namespace dxvk {
// NV-DXVK start: DLFG integration
VkResult status = presenter->acquireNextImage(sync, imageIndex);
// NV-DXVK end
while (status != VK_SUCCESS && status != VK_SUBOPTIMAL_KHR) {

while (status != VK_SUCCESS) {
RecreateSwapChain(m_vsync);

// NV-DXVK start: DLFG integration
info = presenter->info();
status = presenter->acquireNextImage(sync, imageIndex);
// NV-DXVK end

if (status == VK_SUBOPTIMAL_KHR)
break;
}

m_context->beginRecording(
Expand Down

0 comments on commit 0f7c200

Please sign in to comment.