diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-07-15 13:43:08 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-07-19 10:40:55 +0000 |
commit | 4cb2552313280384b59ee1e7d7fc557c7bd64a68 (patch) | |
tree | 1a6bf0e0abd9a6d952d2d4ab72f20f71e13ba79b /src/plugins/scenegraph | |
parent | b4fc940978e7995e75f17a5386c30ef42333bd38 (diff) |
software: Add support for QSGRenderNode
Have to change getResource() a bit since it turns out it is not suitable
currently for backends that do not have a per-window rendercontext and do
not implement the interface on the rendercontext. Pass in the window to
make sure it can always figure out which window we want the resources for.
(we do not want rendererInterface() to return window-specific instances
created on the fly, with ownership issues, so stick with the simple model
where backends implement the interface on one of their existing classes)
To support clipping, QSGRenderNode::RenderState is extended accordingly.
Also updated the docs since some claims in the rendernode docs are not true
since Qt 5.3.
Change-Id: I34779c83926f5231b888fcab7131e873ae97964f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/plugins/scenegraph')
6 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp index 43f765cd38..eab762f7c1 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp @@ -549,7 +549,7 @@ void QSGD3D12Engine::simulateDeviceLoss() d->simulateDeviceLoss(); } -void *QSGD3D12Engine::getResource(QSGRendererInterface::Resource resource) const +void *QSGD3D12Engine::getResource(QQuickWindow *, QSGRendererInterface::Resource resource) const { return d->getResource(resource); } diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h index 72007b96db..46cd73e63a 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h +++ b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h @@ -372,7 +372,7 @@ public: void simulateDeviceLoss(); - void *getResource(QSGRendererInterface::Resource resource) const; + void *getResource(QQuickWindow *window, QSGRendererInterface::Resource resource) const; private: QSGD3D12EnginePrivate *d; diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp index 09129c954d..4ee4656e63 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp @@ -141,14 +141,14 @@ QSGRendererInterface::GraphicsApi QSGD3D12RenderContext::graphicsApi() const return Direct3D12; } -void *QSGD3D12RenderContext::getResource(Resource resource) const +void *QSGD3D12RenderContext::getResource(QQuickWindow *window, Resource resource) const { if (!m_engine) { qWarning("getResource: No D3D12 engine available yet (window not exposed?)"); return nullptr; } - - return m_engine->getResource(resource); + // window can be ignored since the rendercontext and engine are both per window + return m_engine->getResource(window, resource); } QSGRendererInterface::ShaderType QSGD3D12RenderContext::shaderType() const diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h index ca85aaa46f..35aca100f4 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h +++ b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h @@ -75,7 +75,7 @@ public: // QSGRendererInterface GraphicsApi graphicsApi() const override; - void *getResource(Resource resource) const override; + void *getResource(QQuickWindow *window, Resource resource) const override; ShaderType shaderType() const override; ShaderCompilationTypes shaderCompilationType() const override; ShaderSourceTypes shaderSourceType() const override; diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp index 5e5d7a13f8..ce633ae996 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp @@ -451,6 +451,7 @@ struct RenderNodeState : public QSGRenderNode::RenderState bool scissorEnabled() const { return m_scissorEnabled; } int stencilValue() const { return m_stencilValue; } bool stencilEnabled() const { return m_stencilEnabled; } + const QRegion *clipRegion() const override { return nullptr; } const QMatrix4x4 *m_projectionMatrix; QRect m_scissorRect; diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp index ec3427a9cc..c53a1fa6c1 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp @@ -279,6 +279,8 @@ QSGContext *QSGD3D12RenderLoop::sceneGraphContext() const QSGRenderContext *QSGD3D12RenderLoop::createRenderContext(QSGContext *) const { + // The rendercontext and engine are per-window, like with the threaded + // loop, but unlike the non-threaded OpenGL variants. return sg->createRenderContext(); } |