aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-08-28 15:18:44 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-09-08 09:41:27 +0200
commitee702d94368140618fc4777a0e247219a28d39c8 (patch)
treee48c9b7cceec01c67add7fcf51a011497fd3b7ea /src
parent76bec768a5bf9ff29fdc439cbe5a85d36590a6df (diff)
Make vulkanunderqml work and update docs
What we are doing for now is setting ExternalContentsInPass always. This way vulkanunderqml works as expected. For applications that do not integrate external rendering this means that there is now an additional secondary command buffer per render pass, but we can live with this for now. Later (Qt 6) there should be a way to declare this (that the application will want to issue native rendering stuff) up front in QQuickWindow or somewhere. Change-Id: I736741f9b0eee2f8295b046bacdce862e6a546f5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickwindow.cpp11
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp4
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp4
3 files changed, 17 insertions, 2 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 27e2a4572e..4e65c60b85 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -4773,6 +4773,17 @@ const QQuickWindow::GraphicsStateInfo *QQuickWindow::graphicsStateInfo()
because the scene graph performs the necessary steps implicitly for render
nodes.
+ Native graphics objects (such as, graphics device, command buffer or
+ encoder) are accessible via QSGRendererInterface::getResource().
+
+ \warning Watch out for the fact that
+ QSGRendererInterface::CommandListResource may return a different object
+ between beginExternalCommands() - endExternalCommands(). This can happen
+ when the underlying implementation provides a dedicated secondary command
+ buffer for recording external graphics commands within a render pass.
+ Therefore, always query CommandListResource after calling this function. Do
+ not attempt to reuse an object from an earlier query.
+
\note This function has no effect when the scene graph is using OpenGL
directly and the RHI graphics abstraction layer is not in use. Refer to
resetOpenGLState() in that case.
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 08d1c726ab..f15105168e 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -648,7 +648,9 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
}
Q_ASSERT(rhi == cd->rhi);
- QRhi::FrameOpResult frameResult = rhi->beginFrame(cd->swapchain);
+ // ### the flag should only be set when the app requests it, but there's no way to do that right now
+ QRhi::BeginFrameFlags frameFlags = QRhi::ExternalContentsInPass;
+ QRhi::FrameOpResult frameResult = rhi->beginFrame(cd->swapchain, frameFlags);
if (frameResult != QRhi::FrameOpSuccess) {
if (frameResult == QRhi::FrameOpDeviceLost)
qWarning("Device lost");
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 9e34a2b201..9bcb96a65a 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -713,7 +713,9 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
}
Q_ASSERT(rhi == cd->rhi);
- QRhi::FrameOpResult frameResult = rhi->beginFrame(cd->swapchain);
+ // ### the flag should only be set when the app requests it, but there's no way to do that right now
+ QRhi::BeginFrameFlags frameFlags = QRhi::ExternalContentsInPass;
+ QRhi::FrameOpResult frameResult = rhi->beginFrame(cd->swapchain, frameFlags);
if (frameResult != QRhi::FrameOpSuccess) {
if (frameResult == QRhi::FrameOpDeviceLost)
qWarning("Device lost");