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/qsgthreadedrenderloop.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/qsgthreadedrenderloop.cpp')
| -rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 9bcb96a65a..eb6eec342c 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -924,6 +924,13 @@ void QSGRenderThread::run() if (rhi && !cd->swapchain) { cd->rhi = rhi; 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(), @@ -931,7 +938,8 @@ void QSGRenderThread::run() 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(); |
