summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhi.cpp
diff options
context:
space:
mode:
authorKristoffer Skau <kristoffer.skau@qt.io>2022-10-25 22:30:15 +0200
committerKristoffer Skau <kristoffer.skau@qt.io>2022-11-07 09:08:44 +0100
commitc9ad5ad3b73ff60e9a40173b1ae49e67800a4b72 (patch)
treed5e2c7e2ad0c9e597b8c2d2922f37e33aa8dde1f /src/gui/rhi/qrhi.cpp
parent516871d3e5d7815c0fb4a93c71f8cb35f7b3325c (diff)
Add support for stereoscopic content in QRhi::OpenGLES2
Setting the flag QSurfaceFormat::StereoBuffers does not actually do anything, because we do not utilize the extra buffers provided. We need to expose setting the correct buffers using glDrawBuffers between draw calls. Change-Id: I6a5110405e621030ac3a2886fa83df0cfe928723 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi.cpp')
-rw-r--r--src/gui/rhi/qrhi.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index 701cecb3d1..20f4b4beae 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -4860,6 +4860,35 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
*/
/*!
+ \enum QRhiSwapChain::StereoTargetBuffer
+ Selects the backbuffer to use with a stereoscopic swapchain.
+
+ \value LeftBuffer
+ \value RightBuffer
+ */
+
+/*!
+ \return a render target that can be used with beginPass() in order to
+ render to the swapchain's left or right backbuffer. This overload should be
+ used only with stereoscopic rendering, that is, when the associated QWindow
+ is backed by two color buffers, one for each eye, instead of just one.
+
+ When stereoscopic rendering is not supported, the return value will be
+ null. For the time being the only backend and 3D API where traditional
+ stereoscopic rendering is supported is OpenGL (excluding OpenGL ES), in
+ combination with \l QSurfaceFormat::StereoBuffers, assuming it is supported
+ by the graphics and display driver stack at run time. All other backends
+ are going to return null from this overload.
+
+ \note the value must not be cached and reused between frames
+ */
+QRhiRenderTarget *QRhiSwapChain::currentFrameRenderTarget(StereoTargetBuffer targetBuffer)
+{
+ Q_UNUSED(targetBuffer);
+ return nullptr;
+}
+
+/*!
\fn bool QRhiSwapChain::createOrResize()
Creates the swapchain if not already done and resizes the swapchain buffers