diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-09-23 10:07:36 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-09-23 12:28:15 +0200 |
commit | 6761636bf7f3f90b7c82e4ac7be79d9d6a032d52 (patch) | |
tree | 671d5519860b32d0038c5eff699e6c84a2cb4f3d /src/quick/scenegraph | |
parent | a90f7fc640d612a2524f6bb1522d786960e3a573 (diff) |
Map swap interval 0 to NoVSync with all the APIs
What exactly this will cause is another question. But at least now the
traditional OpenGL way of setting the QSurfaceFormat's swapInterval 0
will have an effect with the other APIs as well.
Change-Id: I6d50952502a70e84828ed87347e2a948299f6f42
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 80f022ddb4..2924516eaf 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -526,15 +526,21 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) rhiSupport->prepareWindowForRhi(window); QRhiSwapChain::Flags flags = QRhiSwapChain::UsedAsTransferSource; // may be used in a grab + const QSurfaceFormat requestedFormat = window->requestedFormat(); // 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; + const bool alpha = requestedFormat.alphaBufferSize() > 0; if (alpha) flags |= QRhiSwapChain::SurfaceHasPreMulAlpha; + // Request NoVSync if swap interval was set to 0. What this means in + // practice is another question, but at least we tried. + if (requestedFormat.swapInterval() == 0) + flags |= QRhiSwapChain::NoVSync; + cd->swapchain = rhi->newSwapChain(); static bool depthBufferEnabled = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER"); if (depthBufferEnabled) { diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index a4bd6ba7ef..bdd0d20d64 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -930,13 +930,21 @@ void QSGRenderThread::ensureRhi() if (rhi && !cd->swapchain) { cd->rhi = rhi; QRhiSwapChain::Flags flags = QRhiSwapChain::UsedAsTransferSource; // may be used in a grab + const QSurfaceFormat requestedFormat = window->requestedFormat(); + // 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; + const bool alpha = requestedFormat.alphaBufferSize() > 0; if (alpha) flags |= QRhiSwapChain::SurfaceHasPreMulAlpha; + + // Request NoVSync if swap interval was set to 0. What this means in + // practice is another question, but at least we tried. + if (requestedFormat.swapInterval() == 0) + flags |= QRhiSwapChain::NoVSync; + cd->swapchain = rhi->newSwapChain(); static bool depthBufferEnabled = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER"); if (depthBufferEnabled) { |