diff options
author | Laszlo Agocs <[email protected]> | 2020-06-05 18:10:30 +0200 |
---|---|---|
committer | Laszlo Agocs <[email protected]> | 2020-06-09 21:13:21 +0200 |
commit | 22d8db1e115b120ce2f62896eb7fea452348941e (patch) | |
tree | beb189edc62ce1a5bee433827415f0dd95fe7272 /src/quick/scenegraph/adaptations/software | |
parent | 84b53c165e9d492a547c04499450007d2c293bc8 (diff) |
Add perspective 3D plane render mode
One can now do rc->createRenderer(QSGRenderContext::RenderMode3D) in Quick3D.
By default nothing changes, both QQuickWindow and QSGRhiLayer default to
either RenderMode2D or RenderMode2DNoDepthBuffer, depending on
QSG_NO_DEPTH_BUFFER. (the environment variable handling is moved out of
qsgbatchrenderer.cpp however, leaving it up to whoever is creating the
renderer to passing the appropriate flag)
The RenderMode3D mode is a modified version of the QSG_NO_DEPTH_BUFFER case:
only alpha batches are used, which are then rendered back to front. The
difference is that this is done with depth test on (no write), so the
2D content gets depth tested against whatever is already in the depth buffer.
Then, there's an additional depth "post pass" to fill the depth buffer with the
2D content. This must be separate from the color-write enabled stage because
otherwise unavoidable Z fighting would occur. By filling the depth buffer,
other 3D or 2D content, that is rendered afterwards, can depth test correctly
against the 2D elements rendered here.
customRenderMode and related functions are renamed to visualization
(because that's what it is about), in order to prevent confusing name
clashes.
Change-Id: I0d43b273e0a8020af05a652a236c0ad5fb150685
Reviewed-by: Andy Nichols <[email protected]>
Diffstat (limited to 'src/quick/scenegraph/adaptations/software')
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp index 4cb016562f..4f61e615f6 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp @@ -151,7 +151,7 @@ QSGTexture *QSGSoftwareRenderContext::createTexture(const QImage &image, uint fl return new QSGSoftwarePixmapTexture(image, flags); } -QSGRenderer *QSGSoftwareRenderContext::createRenderer() +QSGRenderer *QSGSoftwareRenderContext::createRenderer(RenderMode) { return new QSGSoftwareRenderer(this); } diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h index 22f64bc70c..c523bfbb13 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h @@ -74,7 +74,7 @@ public: void invalidate() override; void renderNextFrame(QSGRenderer *renderer) override; QSGTexture *createTexture(const QImage &image, uint flags = CreateTexture_Alpha) const override; - QSGRenderer *createRenderer() override; + QSGRenderer *createRenderer(RenderMode) override; int maxTextureSize() const override; bool m_initialized; |