aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/adaptations
Commit message (Collapse)AuthorAgeFilesLines
* Software Adaptation: Fix nested clipping logicAndy Nichols2017-07-171-2/+2
| | | | | | Task-number: QTBUG-61939 Change-Id: Ibb7f242241df0a7a418ab4f268487e72d5595622 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Delay the deletion of QSGTextures until all windows are synchronizedDominik Holland2017-06-162-0/+3
| | | | | | | | | | | | | | | | With the 'basic' and the 'windows' render loop the scene graph context is shared. Because of this we cannot start deleting textures after the first window is synchronized as it may contain textures needed by the another window, which is not yet synchronized. QWindowPrivate::syncSceneGraph() is not calling endSync() anymore as it doesn't know whether it is the last window or not. Instead the renderloop is now responsible for calling endSync() once this is safe to do. Change-Id: Icb50ebfb447c928e38b41df7e26f3bfafdb4a811 Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com> Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
* Don't detach temporary containerSérgio Martins2017-06-071-2/+2
| | | | | Change-Id: I3edebdd149d901992b7db5410bb871ba1bcd454e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Improve dirty region calculation in software rendererJüri Valdmann2017-05-233-36/+55
| | | | | | | | | | | | | | | | | | | | | The software renderers dirty region calculation is done in integral logical coordinates, which leads to quite some trouble when handling scene graph elements with fractional coordinates (used by WebEngine for example). The optimal solution would probably be to either use integral physical coordinates or floating point logical coordinates, however this would seem to require substantial changes to QPainter and QBackingStore and so on. So, this patch instead changes the calculation to use something like interval arithmetic: instead of just rounding each logical coordinate to the nearest integer the renderer now uses (very carefully) both the upper and lower boundaries to make sure that the dirty regions always err on the side of caution. I expect this change to make rendering slower but only in situations where previously there would be rendering errors. Task-number: QTBUG-60393 Change-Id: I7f8e7d2739c810328c841130df9c1c7332439447 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Software: Fix leaking of SGTexturesAndy Nichols2017-05-051-0/+3
| | | | | | Task-number: QTBUG-59865 Change-Id: I18911734b34e535c2c77d5a860bd776105617663 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Run includemocs in qtdeclarativeThiago Macieira2017-04-265-0/+9
| | | | | Change-Id: I84e363d735b443cb9beefffd14b8c023a37aa489 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Software: Flush whole window on Expose eventAndy Nichols2017-02-282-4/+7
| | | | | | | | | | | | | | | The software render loop updates the window content via either an expose event or an update event. An expose event should always flush the entire backingstore, but previously only the newly updated region would be flushed. The first time a window is exposed this is fine because the whole scene would be rendered, but when hidden and shown again, the software renderer might show that nothing has changed, and nothing would be flushed. A new flag has been added that forces a full window flush for an expose event. Task-number: QTBUG-59177 Change-Id: I3700bbcc76bc97be4eb0c822e2945ebef339f11a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QSGThreadedRenderLoop: Correctly stop the animation timer ...Robin Burchell2017-01-121-0/+5
| | | | | | | | | | | | | | | | | | | ... when destroying the last window while it is still visible. For the case of windowDestroyed(), the QQuickWindow can still be isVisible true and isExposed true. Given these circumstances, we would not stop the timer (assuming that we needed to keep it running), but this is actually wrong when we are evaluating a timer change depending on the window being destroyed. By calling startOrStopAnimationTimer again, after the window has been removed from m_windows, we will successfully stop the timer -- the only cost being an unnecessary polish event being sent from the first call (which will be ignored). Task-number: QTBUG-58091 Change-Id: I043ce5d88eafee15019e1c8d41c06d531d1da059 Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-142-12/+24
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-282-12/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The renderers added in 5.8 had to be adapted to the changed profiling macros from 5.6. Conflicts: src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp src/quick/util/qquickprofiler_p.h tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp Change-Id: Icb370b7c95aab12589ad73881ac6d178759a5c6b
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-231-1/+1
|\| | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4object_p.h Change-Id: Iff4d3aba7710a999b8befdc493cbe959e1ce02f9
| * QSGRendererInterface: Add Resource suffix for consistencyLaszlo Agocs2016-11-181-1/+1
| | | | | | | | | | Change-Id: I60e674760725d4c4dd13f53b31c3abb6b09c1790 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-1810-2/+37
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4variantobject.cpp src/qml/types/qquickworkerscript.cpp src/quick/scenegraph/util/qsgdefaultpainternode_p.h tools/qmljs/qmljs.cpp Change-Id: I876242714ec8c046238d8fd673a5ace2455b2b59
| * Make Sprite a configurable featureLars Knoll2016-10-1010-2/+37
| | | | | | | | | | | | Change-Id: Iab5c5261cb3cdce3d02fa6cd19ae6f594b6fc649 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-09-211-2/+11
|\| | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4isel_moth_p.h Change-Id: I8e86a649d1ef8ad27dc66cc8c290093b2faabc69
| * Fix crash when using Software Renderer on HiDPI QBackingStoreAndy Nichols2016-09-151-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | For some reason the QPaintDevice of a QBackingStore is not valid on HiDPI QBackingStores until QBackingStore::begin() has been called. I suspect this is a bug in qtbase, but until this is fixed this change will make sure that the paint device will always be valid, even in this unusual situation. Task-number: QTBUG-55875 Change-Id: I63137d0de9b68d29bfcf86d1807f576923875b5d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Use QByteArrayLiteral more judiciouslyAnton Kudryavtsev2016-09-031-1/+1
|/ | | | | | | | | | Replace it with char* literal in overloaded functions. Saves some text size. Change-Id: Iede24c2169d7329aa17c2175b10873c98c27361f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Quick: fix incorrect usage of 'range for' with Qt containersAnton Kudryavtsev2016-08-201-3/+1
| | | | | | | Also port remaining foreach to 'range for'. Change-Id: I20296bb3bb6d63f144ebddaba02cabeb16b7d734 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QSG: Fix inconsistent use of 'override'Erik Verbruggen2016-08-101-5/+5
| | | | | | | | | qsgsoftwarerenderablenode.cpp:221:11: warning: 'scissorRect' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] (plus 4 more) Change-Id: Ie6b85d2eba9e3fbda8cfdc03abfece98df1bb28f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QSGSoftwareAdaptation: Also claim the "softwarecontext" keyRobin Burchell2016-08-041-1/+1
| | | | | | | | This key was formerly used by the external plugin, so we should continue to respect it to maintain compatibility with it. Change-Id: I76118250d8ce94aad200c6d4d9f00b8f8cd968ea Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add optional flags and rect to QSGRenderNodeLaszlo Agocs2016-08-021-3/+15
| | | | | | | | | | | | Having rendernodes triggering fullscreen updates with the software backend is not ideal. Therefore, introduce the option of reporting that the rendernode is well-behaving, meaning it only writes inside the reported bounding rectangle. Similarly, the OpenGL batch renderer can keep using the depth buffer when the rendernode is known to behave like the renderer expects. Change-Id: I6acc434432c2504776f26e8917b5434b44be293d Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Software Adaptation: Fix issue with clip node handlingAndy Nichols2016-07-271-1/+2
| | | | | | | | Under certain circumstances the clip node state would not get propagated properly to child nodes. Change-Id: I6f34690c7cc6f2837854fbcaff9aa4d7522e47c3 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Software Adaptation: Add threaded render loopAndy Nichols2016-07-274-2/+1124
| | | | | | | | | | | This is a new attempt at providing a threaded render loop for the software adaptation in scenegraph. This approach is modeled after the D3D12 backend, and provides a separate thread for each window. To enable use the environment variable QSG_RENDER_LOOP=threaded as with the other backends. Change-Id: I6932975dd9c5579d36f0135aa4626dcc43b45ecd Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* SoftwareImageNodes: Support textureFiltering and mirroringAndy Nichols2016-07-192-8/+63
| | | | | | | Missing features in the QSGImageNode based software node. Change-Id: If6a759873d201307e013a3ab019bd906d98ba7d5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* software: Add support for QSGRenderNodeLaszlo Agocs2016-07-1910-9/+106
| | | | | | | | | | | | | | | | | 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>
* Fix rendercontrol grabs with the software backendLaszlo Agocs2016-07-154-1/+14
| | | | | | | | | | | | Calling grabWindow recurses (since that is implemented via QQuickRenderControl::grab...) so it's not an option. Instead, call directly in the software renderer implementation. Fix also the size of the offscreen QQuickWindow when using QQuickWidget in combination with the software backend. Change-Id: I857a2cc0aebbbaa5d52d809aeaec37c15b0787b9 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add QSGSpriteNode to the Scenegraph Adaptation LayerAndy Nichols2016-07-1411-3/+287
| | | | | | | | | | | | Most core Qt Quick items use one of the nodes provided by the Scenegraph Adaptation Layer, however the two items that provide support for Sprites created their own custom nodes. There was significant redundancy in this, and it made it only possible to use the OpenGL adaptation. The AnimatedSprite and SpriteSequence items have been cleaned up, and now use the new QSGSpriteNode. Change-Id: Idc20b9c5da9dc1c94f6368021785382cdf7cec5a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* scenegraph: Port foreach to range-forRobin Burchell2016-07-091-2/+2
| | | | | Change-Id: I5e7c144e60959b9230c0757b4ad0e035f5f52f58 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qsgsoftwarerenderloop: Don't lie about which render loop is runningRobin Burchell2016-07-051-1/+1
| | | | | | | I forsee this as a good way to get confused in the future otherwise. Change-Id: I85a76bc4666db206b694b6fca6bdcc410e159126 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Make QSGRenderContext::invalidate a no-opLaszlo Agocs2016-07-011-1/+2
| | | | | | | | | | | | | | | | | | Calling invalidate() from the destructor is a bad idea since what we get is the QSGRenderContext implementation, not the one from the more-derived class. (it could have been intentional as well - it is confusing in any case and unnecessary). There is no adaptation relying in this anyways - invalidate() is always invoked manually, typically from windowDestroyed. This is very good since it avoids the at first less-than-obvious trouble with emitting invalidated() from the rendercontext dtor. (that can in turn can trigger random amount of code potentially calling back into the rendercontext and rely on virtuals which are not functional anymore due to the vtable not there for the functions in the more-derived class) Change-Id: I44d78c5a819230f7006d33d4341eff45d8f77c88 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add mipmapping support to QSGImageNodePaolo Angelelli2016-06-281-0/+3
| | | | | | | | | This patch adds two virtual methods to QSGImageNode to set/get the filtering mode for mipmapping, which makes it also possible to enable it, which was previously not possible Change-Id: Ie08a11aab35d8ba335841ca0eb73ef4b3d184d7e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Software Adaptation: Improve clip node handlingAndy Nichols2016-06-284-9/+25
| | | | | | | | | | | | | | | | This commit solves two issues that were coming up with nested clip nodes. The first was that determining the intersection of two or more nested clip nodes was calculated incorrectly. This was fixed by making sure the calculated clip region was in the correct coordinate space. The second issue was because there was no distinction between an empty unclipped region, and a completely clipped region. So a property was added to specify when a RenderableNode had a clipRegion so that the empty QRegion could be interpreted correctly. This makes sure that we don't end up drawing nodes that were culled. Change-Id: Id7af092f7fc6a4602b44b585b7dee14084136962 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix rendering clipped texture and image nodesAllan Sandfeld Jensen2016-06-242-4/+4
| | | | | | | | The entire texture node was always used causing scaling for any node with a source clip. Change-Id: I7c6f946cee6d59ad3ae64302f3a28782eba8f5da Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add cross-backend simple rect, texture, and ninepatch nodesLaszlo Agocs2016-06-2215-129/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QSGSimpleRectNode is deprecated -> use QSGRectangleNode via QQuickWindow::createRectangleNode() instead. QSGSimpleTextureNode is deprecated -> use QSGImageNode via QQuickWindow::createImageNode() instead. The OpenGL version of the simple rectangle node is switched over to the vertex color material instead of flat, to allow for better batching. Use the same concept for nine patch nodes. The "style" node from Quick Controls 1 is now QSGNinePatchNode in order to provide a proper cross-backend solution which is already necessary due to the software backend, but now generalize it to apply to the accelerated backends with proper materials as well. QC can now simply call createNinePatchNode() without further ado. Also fixes a bug with the D3D12 texture material not enabling blending when needed. When it comes to the internal class names, QSGRectangleNode and QSGImageNode get the Internal prefix in the adaptation layer in order to differentiate from the public API. This involves quite a lot of renaming, but results in a nice and clean public API. Change-Id: Iddf9f9412377843ea6d652bcf25e68d1d74659ea Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Software Renderer: Call QBackingStore::beginPaint with correct QRegionAndy Nichols2016-06-205-10/+36
| | | | | | | | | | | | | | | | | When rendering into QBackingStores, it is important to let the backingstore know what region you intended to paint into before you start rendering. Previously we were calling QBackingStore::beginPaint on the whole window area, but then only rendering and flushing for a subset of that area. This causes issues on platforms that depend on QBackingStore::beginPaint to be all area that will be repainted before the next flush, so that they can for example clear those areas. This change required a bit of extra plumbing in the Software Renderer, but now it is possible to calculate the area that will be repainted before painting it, and pass that region to QBackingStore::beginPaint(). Change-Id: I90be1916ebbe8fc182cd13246bb6690cc7e16d27 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Software Image Node: Do not make equality check in setTextureAndy Nichols2016-06-201-5/+3
| | | | | | | | | | | | | | | | | When setTexture was called on the Software image node, we were doing a check to see if the QSGTexture pointer was the same as the current texture assuming it meant that if they were the same pointer then it was in fact the same texture, and thus not dirty. This was a wrong assumption, because the texture data can be different but still use the same pointer. So the node should always respond by updating the texture when setTexture is called and mark the nodes material as dirty for the renderer. This allows canvas items to be updated at runtime with the software renderer. Change-Id: Idf504035a6aa858e865050a58460189a12e77ad4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* remove unused qsg_render_timing variableShawn Rutledge2016-06-131-4/+0
| | | | | | | | GCC started giving warnings, and warnings are errors so this broke the build. Change-Id: I546db5a63dfe52b9487016deb3c9eae0bf7c5885 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Software Adaptation: Explicitly detach backingstore image on grabAndy Nichols2016-06-101-0/+1
| | | | | | | | | Some platforms like XCB are just wrapping native images with QImage, and need to be explicitly copied before returning, as they buffer becomes invalid once the backingstore is destroyed. Change-Id: I51f87c5abf4c180c02587f36b5ce4c28e8fa4aed Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Software Adaptation: Obey QQuickWindow::TextureIsOpaque flagAndy Nichols2016-06-073-6/+11
| | | | | | | | | | | Force a image format conversion when requesting an Opaque texture. There seems to be no way to do this with QPixmap::fromImage(...) so a copy of the QImage must be made first which is unfortunate. This is further evidence that the Texture should be QImage based instead of QPixmap based by default. Change-Id: I89fb380e8e786d4ff93f01eb6466e118c2851f7a Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Avoid ifdefed enumLaszlo Agocs2016-06-021-1/+1
| | | | | | | | | Do it like in QSGGeometry: use the values directly to avoid the GL header dependency. Change-Id: Ia83dea5cbbab7dfee8b88d1b01fcfcb51ad41fc1 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* One GraphicsInfo to rule them allLaszlo Agocs2016-06-012-0/+18
| | | | | | | | | Rename RendererInfo to GraphicsInfo. Deprecate OpenGLInfo and move the surface format properties into GraphicsInfo. Move also the shader info properties from ShaderEffect. Change-Id: I3b3f01080e059b3a30a132fd67de19a4bfca54ef Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Change graphicsAPI to graphicsApiLaszlo Agocs2016-06-012-2/+2
| | | | | Change-Id: I065f17abd1cb71cd8d6ead76abf7a544eb7a99c0 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Merge remote-tracking branch 'origin/dev' into scenegraphngAndy Nichols2016-05-311-1/+1
| | | | Change-Id: I35715e07b6f837f21cd8e8898f19d97af92c6b69
* Fix some test failures with QT_NO_OPENGL buildsAndy Nichols2016-05-061-7/+19
| | | | | Change-Id: I4154084b4a0e0709ee8cb39a856a37a611e2d537 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Fix building with QT_NO_OPENGL definedAndy Nichols2016-05-061-0/+3
| | | | | Change-Id: Ice6c47f766899e7313b9dde8cfcd6d81eeaf52f5 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Adaptable shader effect enablersLaszlo Agocs2016-04-291-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The D3D12 node implementation is mostly missing. The rest of the enablers should be in place now however. Importing QtQuick 2.8 provides new properties for ShaderEffect: - shaderType can be used to decide which language should be used - shaderCompilationType tells if compilation is runtime or offline - shaderSourceType tells if the vertex/fragmentShader properties refer to source strings or source files or pre-compiled bytecode files The last two are bitmasks. In practice however we will support only one approach per backend for now (runtime + source string for OpenGL, offline + bytecode for D3D12). In addition to QSGShaderEffectNode, introduce the QSGGuiThreadShaderEffectManager interface. This provides the gui thread bits for the above and performs shader reflection. Backends that use the new ShaderEffect system must provide both. For each ShaderEffect item there will be a manager (on the gui thread) and a node (on the render thread). Reflection is expected to be done via standard helper libs (d3d12shader + D3DReflect from d3dcompiler for the D3D12 backend), or via manually inspecting SPIR-V, or parsing the source (like the GL path does now), or by using some 3rd party library (not recommended). In any case we require that reflection is doable on the gui thread without dependencies to the actual graphics API. The ShaderEffect documentation is greatly extended, covering HLSL and the new properties. The test app uses manually compiled shaders on its HLSL path for now. This is because there is no story yet for build system integration for public use (the internal HLSL -> bytecode in C header rule is only suitable for the d3d12 plugin itself, apps need something different). Change-Id: Id112104906fbcb26b9902a35f19d8d509b340d1b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QQuickWidget: Partial update support with software renderingAndy Nichols2016-04-201-1/+2
| | | | | Change-Id: I886287812c1c3cd56739e24470492adc90cfafbb Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* QQuickWidget: Enable use with software renderer backendAndy Nichols2016-04-201-1/+1
| | | | | Change-Id: Ic7a550e55cc4ece4c3a5547dae5bf0dbb3f5b0ac Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* 2DRenderer: Have renderers tied to QPaintDeviceAndy Nichols2016-04-208-73/+53
| | | | | | | | | | | Previously the software renderer would create a backing store for a given window if one was needed. This has been moved to the render loop where the backingstore is flushed to the window. This refactoring should make the software renderers flexible enough to work with QQuickRenderControl. Change-Id: Idbbb1da870afbf28e45213a887be68dba11dc592 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Make rendernode suitable for public consumptionLaszlo Agocs2016-04-202-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For non-OpenGL APIs the primary (and likely the only) way to add custom rendering into the Qt Quick scene is via the render node. Other approaches,like the before/afterRendering signals, QQuickFramebufferObject, remain OpenGL-only. (although QQuickFramebufferObject may get a multi-API replacement based on QSGRenderNode at a later time) Note that this is not a generic 3D content integration enabler. It targets creating 2D and 2.5D Quick items with custom rendering via the graphics API in use. Make QSGRenderNode public, enhance the docs a bit and add a releaseResources(). Add a QSGRendererInterface with a query function in QQuickWindow and QSGEngine. The scenegraph adaptation can then return a custom implementation of the interface. This will be necessary to query API-specific values, f.ex. the ID3D12Device and ID3D12CommandList when running with the d3d12 backend. The interface allows querying the API and void* resources. Resources that we know about in advance are enum-based to prevent the QPlatformNativeInterface-like ugliness of string keys. Support is there in the batch renderer already, fix this up according to the new public API, and implement the corresponding bits for the D3D12 renderer. For D3D12, fix also an issue with QSGNode destruction where graphics resources in use were attempted to be final-released without a proper wait. The semantics of changedStates() in QSGRenderNode is changed so that it can be called at any time, including before render(). This is very useful since we can implement some state restoring in a more efficient manner. Added a new example as well. Documentation for QSGRenderNode is heavily expanded. Change-Id: I4c4a261c55791d0e38743a784bc4c05a53b3462d Reviewed-by: Andy Nichols <andy.nichols@qt.io>