From 3ee65daa74f36434b5a3d78b509247511d7867e1 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 15 Jul 2022 11:07:34 +0200 Subject: rhi: d3d: Switch to DirectComposition for semi-transparent windows A window with alpha > 0 is no longer forced to using a legacy, non-flip swapchain. Instead, the Win8+ DirectComposition API is used in that case to get a properly composited semi-transparent window. The remainings of the non-flip model swapchain support, that was left after purging Windows 7 in order to support semi-transparent windows, is now gone completely. Setting QT_D3D_NO_FLIP has no effect from now on. DXGIFactory2 and flip model swapchains are now always required and in use. There is one downside when it comes to the swap effect: for semi-transparent windows we will be stuck with SCALING_STRETCH as SCALING_NONE is not supported on this path. Using NONE over STRETCH was preferable for typical Qt applications because user interfaces typically look "nicer" during resize without stretching when ending up with a size-mismatched Present. For normal (non-translucent) windows this will continue to be the case, but enabling alpha will now move back to SCALING_STRETCH implicitly. In addition, it looks like AlphaMode is ignored when using CreateSwapChainForComposition. Setting DXGI_ALPHA_MODE_STRAIGHT fails always whereas other values lead to an identical looking (with transparency) result. Therefore we just set it to DXGI_ALPHA_MODE_PREMULTIPLIED regaredless of which QRhiSwapChain alpha flag is set. Fixes: QTBUG-105271 Change-Id: Ie7a584e1656ccfdb506489ea21c41706f57c4018 Reviewed-by: Andy Nichols --- src/gui/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gui/CMakeLists.txt') diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 8d66feee50..32b69350c1 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -424,6 +424,7 @@ qt_internal_extend_target(Gui CONDITION WIN32 d3d11 dxgi dxguid + dcomp ) #### Keys ignored in scope 7:.:.:gui.pro:WIN32: -- cgit v1.2.3