summaryrefslogtreecommitdiffstats
path: root/src/extras
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-07-15 16:17:10 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-07-29 08:03:55 +0200
commit136c016cbe99cd7b8c810c44724e5e3b1b6297e1 (patch)
tree81e05dbf0eddcc70ece85cf54292b3ba47110a59 /src/extras
parentdb611272f595dbb9f381b86d23353dece35df021 (diff)
Refactor Scene3D to work with both RHI and GL Qt3D renderers
- Depending on whether we are using RHI or GL we need to either trigger the rendering after the beforeRendering or beforeRenderPassRecording have been fired -> beforeRendering The RHI command buffer is set up but nothing has been recorded yet. This is what we want for the RHI backend but we will need to make sure we don't call begin/endFrame nor use swap chains other than the one QtQuick is using. This means RenderSurfaceSelector won't be possible. -> beforeRenderPassRecording The RHI command for buffer uploads have been uploaded but the actual RenderPass draw calls have yet to be made. The screen has been cleared already, so this is the best place for the GL backend which expects the screen to have been cleared. - The GL backend can use a QOpenGLFrameBufferObject but that is not possible with the RHI backend. - The RHI backend uses a custom QRhiRenderTarget that takes care of blitting its color attachment into a QRhiTexture which is then bound to a QSGTexture The overall Scene3DItem/Scene3DRender architecture remains the same: - processChange - Render Qt3D content into Texture - Set texture on a custom QSGNode quad Change-Id: Id6c317342d0a227d5295cbfefefc3ed12da160d7 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/extras')
-rw-r--r--src/extras/defaults/qt3dwindow.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/extras/defaults/qt3dwindow.cpp b/src/extras/defaults/qt3dwindow.cpp
index 34264a89f..ffa8d3a4f 100644
--- a/src/extras/defaults/qt3dwindow.cpp
+++ b/src/extras/defaults/qt3dwindow.cpp
@@ -262,7 +262,11 @@ void setupWindowSurface(QWindow *window, Qt3DRender::API api) noexcept
api = Qt3DRender::API::DirectX;
} else if (userRequestedApi == QByteArrayLiteral("null")) {
api = Qt3DRender::API::Null;
+ } else if (userRequestedApi == QByteArrayLiteral("auto")) {
+ api = Qt3DRender::API::RHI;
}
+ } else {
+ api = Qt3DRender::API::RHI;
}
// We have to set the environment so that the backend is able to read it.
@@ -294,6 +298,7 @@ void setupWindowSurface(QWindow *window, Qt3DRender::API api) noexcept
break;
}
#endif
+ case Qt3DRender::API::RHI:
default:
break;
}