rhi: d3d: Skip MakeWindowAssoc. when using dcomp

It has no purpose (like Alt+Enter is not functional anyway when we
created the swapchain for composition), and with D3D12 there is a
warning printed (with the debug layer enabled?) about this. So move
the call to the appropriate branch.

Change-Id: I266ae6835bcc49b3ba8d84e5d08ab9115c6401e0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 300da03e3a0b80797e8cb9ddae90233244704691)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2023-06-21 14:01:08 +02:00 committed by Qt Cherry-pick Bot
parent c12fa6b6fa
commit efd63925d7
2 changed files with 6 additions and 2 deletions

View File

@ -5136,6 +5136,9 @@ bool QD3D11SwapChain::createOrResize()
qWarning("Failed to set content for Direct Composition visual: %s", qWarning("Failed to set content for Direct Composition visual: %s",
qPrintable(QSystemError::windowsComString(hr))); qPrintable(QSystemError::windowsComString(hr)));
} }
} else {
// disable Alt+Enter; not relevant when using DirectComposition
rhiD->dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
} }
} }
if (FAILED(hr)) { if (FAILED(hr)) {
@ -5143,7 +5146,6 @@ bool QD3D11SwapChain::createOrResize()
qPrintable(QSystemError::windowsComString(hr))); qPrintable(QSystemError::windowsComString(hr)));
return false; return false;
} }
rhiD->dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
} else { } else {
releaseBuffers(); releaseBuffers();
// flip model -> buffer count is the real buffer count, not 1 like with the legacy modes // flip model -> buffer count is the real buffer count, not 1 like with the legacy modes

View File

@ -5982,13 +5982,15 @@ bool QD3D12SwapChain::createOrResize()
qWarning("Failed to set content for Direct Composition visual: %s", qWarning("Failed to set content for Direct Composition visual: %s",
qPrintable(QSystemError::windowsComString(hr))); qPrintable(QSystemError::windowsComString(hr)));
} }
} else {
// disable Alt+Enter; not relevant when using DirectComposition
rhiD->dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
} }
} }
if (FAILED(hr)) { if (FAILED(hr)) {
qWarning("Failed to create D3D12 swapchain: %s", qPrintable(QSystemError::windowsComString(hr))); qWarning("Failed to create D3D12 swapchain: %s", qPrintable(QSystemError::windowsComString(hr)));
return false; return false;
} }
rhiD->dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) { for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
hr = rhiD->dev->CreateFence(0, hr = rhiD->dev->CreateFence(0,