diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-09-09 15:31:26 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-09-11 12:32:52 +0200 |
commit | 1bb96cfcce47152c578bcc9a7c2ad80b0f0e6553 (patch) | |
tree | ab85a4c42c6e4dfb1c10c41dea0daf23402439cc /src/quick/scenegraph/qsgrenderloop.cpp | |
parent | 2b566231a6e35ee1646754cee09b30fc99240a80 (diff) |
Request correct alpha composition on the rhi code path
Task-number: QTBUG-78089
Change-Id: I22f8bb5ec0af33397df14e064a0306bd4c5a5ef5
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index f15105168e..25d10d37d4 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -561,6 +561,14 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) QRhiSwapChain::Flags flags = QRhiSwapChain::UsedAsTransferSource; // may be used in a grab + // QQ is always premul alpha. Decide based on alphaBufferSize in + // requestedFormat(). (the platform plugin can override format() but + // what matters here is what the application wanted, hence using the + // requested one) + const bool alpha = window->requestedFormat().alphaBufferSize() > 0; + if (alpha) + flags |= QRhiSwapChain::SurfaceHasPreMulAlpha; + cd->swapchain = rhi->newSwapChain(); cd->depthStencilForSwapchain = rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil, QSize(), @@ -568,7 +576,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) QRhiRenderBuffer::UsedWithSwapChainOnly); cd->swapchain->setWindow(window); cd->swapchain->setDepthStencil(cd->depthStencilForSwapchain); - qCDebug(QSG_LOG_INFO, "MSAA sample count for the swapchain is %d", rhiSampleCount); + qCDebug(QSG_LOG_INFO, "MSAA sample count for the swapchain is %d. Alpha channel requested = %s", + rhiSampleCount, alpha ? "yes" : "no"); cd->swapchain->setSampleCount(rhiSampleCount); cd->swapchain->setFlags(flags); cd->rpDescForSwapchain = cd->swapchain->newCompatibleRenderPassDescriptor(); |