aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgthreadedrenderloop.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add env.vars. to toggle pipeline cache load/saveLaszlo Agocs2021-01-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QRhi has APIs (but private ones) that allow retrieving and restoring the contents of the "pipeline cache". (which may map directly to VkPipelineCache, or may be a simulated, OpenGL program binary based solution) In many cases it is convenient if the saving of the cache blob to a file, and then, during subsequent runs of the application, the loading of cache contents, can be enabled via environment variables: QSG_RHI_PIPELINE_CACHE_SAVE=filename maps to setting the EnablePipelineCacheDataSave flag on the QRhi, and writing the collected data to file upon application exit. (more correctly, when the QRhi is about to be destroyed by the render loop) QSG_RHI_PIPELINE_CACHE_LOAD=filename maps to attempting to read the contents of the specified file, and, if successful, passing it to QRhi right after initialization. When supported and the data is not corrupt or incomplete, the result is likely improved pipeline creation times (the exact details depend on the driver with Vulkan, while with OpenGL it all maps to glProgramBinary instead of compiling from source) Setting QSG_INFO=1 can be useful to see what is happening when the above 2 env.vars. are set. With OpenGL the simulated "pipeline cache" is orthogonal to the Qt 5 era shader program disk cache: loading from both is supported transparently to the application. When QSG_RHI_PIPELINE_CACHE_SAVE is enabled, the disk cache will not be written to. Task-number: QTBUG-90398 Change-Id: I82d9a81e9dab39d3513a6aa7c6e1ff748a4ec6e5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix potentially missing endFrame() in threaded render loopLaszlo Agocs2020-11-171-0/+5
| | | | | | | | | | | | | | | | | Upon a QWindow destroy() and show() we can get to syncAndRenderer with sync not requested. It will be followed by a full sync+render request afterwards, but first we need to gracefully survive that somewhat obscure initial round (obscure because the window is fully usable, so we get a swapchain, but then we do not sync, so there is no QSGRenderer created) Exhibited by tst_qquickwindow::headless. It correctly showed a warning on all platforms and rhi backends, but was only fatal on macOS and Metal for some reason. Fixes: QTBUG-88513 Change-Id: I0396b648af0fd2bef2964b79a28359a7f806530d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Do grabs out of orderLaszlo Agocs2020-10-191-34/+27
| | | | | | | | | | | | | ...while extending the autotest to cover more complicated cases, such as grabbing again after show-hide and doing show-grab-hide-grab-show-grab. In fact some of these cases have not been working in Qt 5. Now the basic render loop is fixed up to support the all the combinations threaded does. Task-number: QTBUG-87399 Change-Id: Id01995bc3a2660b16cfb2f8bedc84becea0be1bb Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Follow rhi per-frame to per-pass flag changeLaszlo Agocs2020-10-051-3/+1
| | | | | Change-Id: I728cecd85807eb835703a0bb8bb4acdb1f2068ae Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Make sure beforeFrameBegin-afterFrameEnd always come in pairsLaszlo Agocs2020-10-021-1/+4
| | | | | | | | | | | | | | | With some platforms there is no valid window size yet when the render thread hits syncAndRender (of course, it does not actually render then). In this case we emitted an afterFrameEnd without a corresponding beforeFrameBegin. Just make sure both signal emissions are under the same condition. This is tested by the frameSignals case in tst_qquickwindow but since that's not exercised with the threaded render loop by the CI atm, the fail was not noticed. Change-Id: I300ffcc117daa4c6163ce15dd60ceffba659bd69 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Map swap interval 0 to NoVSync with all the APIsLaszlo Agocs2020-09-231-1/+9
| | | | | | | | | What exactly this will cause is another question. But at least now the traditional OpenGL way of setting the QSurfaceFormat's swapInterval 0 will have an effect with the other APIs as well. Change-Id: I6d50952502a70e84828ed87347e2a948299f6f42 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Output the thread and window in the render loop timing printsLaszlo Agocs2020-09-091-17/+45
| | | | | | | | Also fixes a plain bug in the basic render loop: using static to measure elapsed time is broken in a multi-window setup. Change-Id: Ie81fd9f4ec274f8ef095a8be7f280173f143de04 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* threaded renderloop: Remove unused variableUlf Hermann2020-09-081-1/+0
| | | | | Change-Id: Ib68ddb664cee1ef1530d8d0bfb59e8d97a7d2f27 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* threaded renderloop: Do not abort with sleep when no changes after syncLaszlo Agocs2020-09-071-17/+10
| | | | | | Task-number: QTBUG-86089 Change-Id: If1b3369d49b5088b78f683d7512b156af3765bce Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Render loops: ignore update reqs during the main polish stepLaszlo Agocs2020-09-071-0/+9
| | | | | | | | | | | | The classic example is Shape, which needs to dirty the QQuickItem in updatePolish() in order to get it picked up in the synchronize step. That part is fine, but we do not want maybeUpdate() to issue a requestUpdate() then since we are effectively in progress of doing an update, so having another full round of polish/sync/render is a waste. Task-number: QTBUG-86089 Change-Id: Ie41563b34da17e7134631791ed024b31e87e21e3 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Document internally the animation handling in the threaded loopLaszlo Agocs2020-09-071-12/+43
| | | | | | | | | | Also rename the incomprehensibly named maybePostPolishRequest(), because it is just a call to QWindow::requestUpdate() nowadays. postUpdateRequest() makes it clear what it is. Task-number: QTBUG-86089 Change-Id: I4c9ca1336c26d163772368067eda0f1ef84b9d97 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix qt.scenegraph.time.renderloop time logjiu2020-08-311-10/+4
| | | | | | Fixes: QTBUG-86209 Change-Id: Iea09d22f09df3b50ebdf55d1c72affb5603bdcda Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Do not create depth/stencil buffer when the env var says soLaszlo Agocs2020-08-161-5/+8
| | | | | | | | | | | | | | | | | | | | | | | Both for the swapchain and more importantly, layers. The latter was never implemented, not in Qt 5 with OpenGL either, and it becomes a problem for resource-limited use cases because QSG_NO_DEPTH_BUFFER still creates depth/stencil attachments for layers even though the 2D rendering has no use for those then. Clarify the QQuickGraphicsConfiguration docs as well. The story is fairly convoluted, because the useDepthFor2D flag one can set from C++ is not 100% the same as the env.var. (and it really should not be) The flag is about relying on depth testing in 2D (and so enabling the potentially more efficient opaque batches), but it does not prevent adding a View3D or other stuff that requires a depth buffer. The env.var on the other hand does both: it (depending on the platform) disables depth (and often stencil) buffers, thus using fewer resources, and also triggers the depth-less 2D rendering path (alpha batches only). But that is not always compatible with 3D then (like an offscren View3D will work, other modes may not) Change-Id: I5ac1ce154fe78a3ec8bd1a698c1c0b944ce8077e Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix before/after frame signal emissionsLaszlo Agocs2020-07-011-2/+3
| | | | | | | | | Make the before signal closer to the actual QRhi::beginFrame() call. This fixes emitting a beforeFrameBegin unnecessarily when unexposing and then exposing a window again. Change-Id: Icc562a57798986c8d04c6800eabc41981c5da85b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* SceneGraph: Check for existing offscreen surface before creating oneUlf Hermann2020-06-171-1/+2
| | | | | | | Otherwise the old one leaks as shown in the QQuickWindow test. Change-Id: I50a8c1b5e7ebc52a2bf9a901d9fae94559d2bcea Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Rename setPersistentOpenGLContext and revise related docsLaszlo Agocs2020-06-111-1/+1
| | | | | | | | | | | | | | | | | | These persistent hints are still taken into account by the threaded render loop, so keep them, but get rid of "OpenGL Context" from the function names. The qquickwindow autotest has been updated accordingly, and with a few OpenGL-related cleanups it now runs without any warnings or skips with OpenGL-on-RHI, while it skips only 1 case when running with some other API, and 2 with the software backend. [ChangeLog][Qt Quick][QQuickWindow] The setPersistentOpenGLContext() and isPersistentOpenGLContext() functions are renamed to setPersistentGraphics() and isPersistentGraphics(). Change-Id: Ifc4cc7c4b94fe9f7e402b39ca4f28952dcafd588 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove customRenderStage from QQuickWindowPrivateLaszlo Agocs2020-06-081-1/+1
| | | | | | | | | | | | This is not maintained and probably not compatible with QRhi-based rendering anyways. Remove it for now. Task-number: QTBUG-84718 Task-number: QTBUG-84623 Change-Id: I423b45e247c751c94f1407cfb53f056d6ea7a10c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Make render loops OpenGL cleanLaszlo Agocs2020-06-081-142/+39
| | | | | | | Task-number: QTBUG-84718 Task-number: QTBUG-84623 Change-Id: I14392c365a52ecc410362500bbe29b4dd7953007 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Do not sync with zero sized, non-initialized windowsLaszlo Agocs2020-06-051-6/+14
| | | | | Change-Id: I0f8583a67b1838b4314ff48173a3e5029ddd6c1d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Remove QQuickOpenGLShaderEffectPaul Olav Tvete2020-06-041-7/+0
| | | | | | | | | This also removes QQuickUniformAnimator, which is not yet ported to RHI (QTBUG-83976) Task-number: QTBUG-83977 Change-Id: I3e656e6817ac991371b7f6557f050e122635d279 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix handling of destroy-show and re-enable the zoom test for qmlpreviewLaszlo Agocs2020-06-031-1/+16
| | | | | | Fixes: QTBUG-84059 Change-Id: Id70c043f96e9525a5a6053efbf99c5ea3408da65 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Follow QRhi create-destroy API updateLaszlo Agocs2020-06-021-1/+1
| | | | | Change-Id: I0bc2cbce373febcb9073f15067eebbc1723462ba Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* rhi: Add support for grabbing non-exposed windowsLaszlo Agocs2020-05-181-1/+1
| | | | | | | | | tst_qquickwindow::grab is now expected to pass in all combinations (both direct GL and RHI with any backend). Task-number: QTBUG-78608 Change-Id: I8c1f2ff3d50144c7dd4498160818d0860b67db15 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Check thread->isRunning before posting WMReleaseSwapchainEventLaszlo Agocs2020-05-111-1/+1
| | | | | | | | | | | | | If the window becomes "obscured" (hidden), rendering (i.e. the render thread) stops. Getting a PlatformSurfaceAboutToBeDestroyed afterwards led to sending (and blocking) the WMReleaseSwapchainEvent to the render thread. This lead to a deadlock. While this is not something that happens normally, the problem is showcased by the "headless" case of the qquickwindow autotest which has a quite aggressive destroy() call on the QQuickWindow. Change-Id: I4726b76646564162af645508e08e35e268fea7e4 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Allow aborting syncAndRender() when sync results in no changesLaszlo Agocs2020-05-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | | This is the behavior with direct OpenGL. With QRhi, we avoided returning early because QRhi::beginFrame() was already called, so rendering the frame seemed like a better choice, at first at least. (the SkipPresent flag was likely introduced at a later point) Now we just do an endFrame() with SkipPresent set, and then return without moving on to the rendering phase. This fixes the noUpdateWhenNothingChanges case in the qquickwindow autotest. Additionally, it is suspected that this also fixes the qquicklayout auto test failures: there we have tests that wait for the frameSwapped() signal. Until now we did not abort the update when sync resulted in no changes (with RHI), which confuses said tests because there is an unexpected frameSwapped() signal emitted. Change-Id: Id6a859d27a525ed2c16c6b331b1ad5debabfcd77 Reviewed-by: Christian Strømme <christian.stromme@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add beforeFrameBegin() and afterFrameEnd() to QQuickWindowLaszlo Agocs2020-04-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New additions to the QQuickWindow signal family. Out of the three stages of the (modern) frame generation process, only two are covered by the existing beforeRendering, beforeRenderPassRecording - afterRenderPassRecording, afterRendering pairs. With the new ones, the rendering of a simple Qt Quick scene looks like the following: emit beforeFrameBegin QRhi::beginFrame() emit beforeRendering ... (additional render passes targeting textures when layers or View3D are involved) QRhi::beginPass() emit beforeRenderPassRecording ... emit afterRenderPassRecording QRhi::endPass() emit afterRendering QRhi::endFrame() emit afterFrameEnd This fits very well the revised QQuickRenderControl API, which has explicit beginFrame-endFrame points as well. So now we can make both QQuickRenderControl and the render loops to emit these signals at the appropriate points. Task-number: QTBUG-83883 Change-Id: Ib385b29393f3b39b0700432d14ea3976cf337fa0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Introduce new mechanism to manage palette functionality in QMLVitaly Fanaskov2020-03-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Main goals of these changes: 1) Add an ability to work with disabled and inactive palettes from QML 2) Eliminate massive code duplication in qtquickcontrols2 module 3) Provide easily extensible architecture for this piece of functionality Architectural part. Palette It was decided to not change existing QPalette, but add thin wrappers around it to provide all required functionality. These wrappers are highly coupled with QPalette class because of using some enum values from it. There are two new classes QQuickPalette and QQuickColorGroup. QQuickPalette class inherits QQuickColorGroup class and represents Active/All color group. QQuickPalette also provides an access to three color groups: Active, Inactive, and Disabled. In order to access colors the special class QQuickPaletteColorProvider is used. This is a wrapper around QPalette that provides some convenience functions. Interface The private property "palette" should be exposed. Implementation All private parts of classes that implement QQuickAbstractPaletteProvider have to inherit QQuickPaletteProviderPrivateBase class. This template class implement all functionality: create palette, resolve dependencies, connect objects etc. This is important to mention that related data is lazily allocatable on demand only. Hence, there is no memory overhead for regular items. Change-Id: I911424b730451b1ad47f68fd8007953b66eddb28 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* rhi: Handle beginFrame() failure correctly in threaded render loopLaszlo Agocs2020-02-061-6/+10
| | | | | | | | Also add some comments to improve maintainability. Task-number: QTBUG-81740 Change-Id: I4be90768f7a8506b1fb493885062b98be9f4f58a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add trace points for Qt Quick Scene GraphMilian Wolff2019-12-131-3/+22
| | | | | | | | | | | | This adds Q_TRACE tracepoints for all places that are covered by the QML profiler's QSG integration. The big advantage over the existing framework is that these trace points can be visualized next to other system tracepoints to correlate the data better with load and resource consumption induced by other processes on the system. Change-Id: I0c5b70a0870f0b89e4533c351c099e13fd18a55f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Clear RequestRepaint bit set in sync() if we are going to renderLaszlo Agocs2019-12-031-13/+24
| | | | | | | | | | | | ...because if we are going to go on doing a frame then the repaint request is fulfilled. Leaving the bit set would cause the render thread's main loop to start another frame right after the current one is queued, which is kind of bad in certain scheduling and blocking cases because the main thread may end up starving due to the unnecessary extra (and sync-less) frame. Task-number: QTBUG-80498 Change-Id: I6c9a8f60e5f49d771d7d284bb7399eadbde33b8c Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Make the initialization failure dialog sensible with QRhiLaszlo Agocs2019-11-281-2/+1
| | | | | | | | | | | | | | | So on Windows one now gets a message box with a reasonable message, instead of the OpenGL nonsense. Then the application closes when pressing Abort etc. On other platforms there is a qFatal, printing the same message. Involves simplifying the OpenGL version a bit since passing isES type of flags through multiple layers is not justified here. Task-number: QTBUG-80365 Change-Id: Ie3ea1e9395a283f7e95eda78c1d3894797ff0acf Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Prevent infinite rhi init failure in threaded render loopLaszlo Agocs2019-11-281-7/+35
| | | | | | Task-number: QTBUG-80365 Change-Id: I929fb76eb8d023ab048f6d1c91be078de3cfe750 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Avoid initializing QFlags with 0 or nullptrAllan Sandfeld Jensen2019-11-221-1/+1
| | | | | | | | | It is being deprecated. Change-Id: I844bd92af85bc53a8fc0371408d05277bd49f511 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix broken scaling with high dpi + rhi + thread loopLaszlo Agocs2019-10-211-3/+1
| | | | | | | | | | | | | | The arguments to renderSceneGraph() were incorrect in the threaded render loop, unlike basic. Fix it up to follow what we do in the basic loop. (The first argument is the QWindow size (logical). The second is only used when rendering via the rhi, and is the output surface/layer size, in pixels. This will get simplified in Qt 6.) This fixes broken rendering with Metal and the threaded render loop for windows with dpr > 1. Change-Id: I427ba5def8cc34900e6fe650e1006ca5f0fa90a4 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* QQuickWindow: Don't leak the animation controllerUlf Hermann2019-10-021-2/+3
| | | | | | | | | There are ways to close the window without hitting the code paths in the render loops that delete the animation controller. Probably if no frame was ever rendered. Change-Id: If3e9d2051525c4ff50eda19084c967578fe4f4b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove depth-stencil buffer sizing on the rhi pathLaszlo Agocs2019-09-301-5/+3
| | | | | | | | | ...as this will be done automatically by QRhiSwapChain after the corresponding QtGui changes. Task-number: QTBUG-78641 Change-Id: I8edeb728f3aba07bfa6bc6331966fba4bdee71f4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Recover from device lost on the rhi path in the threaded loopLaszlo Agocs2019-09-231-61/+100
| | | | | Change-Id: I90d43d5daa75bbc52c9c10f4ef920b898bbd39d4 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Request correct alpha composition on the rhi code pathLaszlo Agocs2019-09-111-1/+9
| | | | | | Task-number: QTBUG-78089 Change-Id: I22f8bb5ec0af33397df14e064a0306bd4c5a5ef5 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Make vulkanunderqml work and update docsLaszlo Agocs2019-09-081-1/+3
| | | | | | | | | | | | | | | What we are doing for now is setting ExternalContentsInPass always. This way vulkanunderqml works as expected. For applications that do not integrate external rendering this means that there is now an additional secondary command buffer per render pass, but we can live with this for now. Later (Qt 6) there should be a way to declare this (that the application will want to issue native rendering stuff) up front in QQuickWindow or somewhere. Change-Id: I736741f9b0eee2f8295b046bacdce862e6a546f5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove an unused event type in the threaded render loopLaszlo Agocs2019-08-221-11/+0
| | | | | Change-Id: I505ba09d6a0144f18bf29cda2f549c8b69ada1a5 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Change rhi-related debug prints to categorized loggingLaszlo Agocs2019-08-021-3/+3
| | | | | Change-Id: I4e8d3111a2f3b77e984756cc9eef49d42f0b647c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Have an autorelease pool for each frame on the render threadLaszlo Agocs2019-07-301-0/+4
| | | | | | | | | | | | | | | | | | Required with Metal. Drawables and various system resources get autoreleased and there is no pool to handle these on the SG render thread by default. This may present a slight perf hit in debug builds due to QMacAutoReleasePool doing smart but - for us - unnecessary stuff every time (so in our case, every frame) but will do for now. This complements the QRhiMetal change for not holding onto the drawable when skipping the present. The pool is essential then to prevent nextDrawable from starving and so blocking. Task-number: QTBUG-76953 Change-Id: Iaf803a0e20504d6b349d3564eda1677868fb29ef Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Avoid locking up on resize with threaded loop and the rhiLaszlo Agocs2019-07-301-4/+18
| | | | | | | | | | This was visible on X11 only because there beginFrame() happened to fail once or twice with out-of-date swapchain when there were a lot of resizes in a row. Handle this case correctly by waking up the main thread as appropriate. Change-Id: I67dc18522e1c05070267fd355095324f48259276 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Enable request setting the (gl) context current on rhi pathLaszlo Agocs2019-07-041-10/+21
| | | | | | | This was disabled due to the unmerged qtbase api change. Change-Id: I38beb8f2aa11dc233765bcfe06e91940b64b5758 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add the graphics api independent scenegraph portLaszlo Agocs2019-07-041-93/+356
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt in via environment variables: QSG_RHI=1 -> enable using QRhi instead of GL QSG_RHI_BACKEND -> set to vulkan, metal, d3d11, gl to override the default (the default is d3d11 on Windows, metal on Mac, gl elsewhere) Or force a given rhi backend via the existing QQuickWindow::setSceneGraphBackend(). Otherwise the default behavior is the same as before, the rhi code path is never active by default. -no-opengl builds are supported in the sense that they work and default to the software backend. However, the rhi code path cannot currently be used in such builds, even though QRhi from qtbase is fully functional with Vulkan, D3D, or Metal even when qtbase was configured with -no-opengl. This cannot be utilized by Quick atm due to OpenGL usage being all over the place in the sources corresponding to the default backend, and those host the rhi code path as well. This will be cleaned up hopefully in Qt 6, with the removal all direct OpenGL usage. Other env.vars.: QSG_RHI_DEBUG_LAYER=1 -> enable D3D debug or Vulkan validation layer (assuming the system is set up for this) QSG_RHI_SHADEREFFECT_DEBUG=1 -> print stuff from ShaderEffect QSG_SAMPLES=1,2,4,... -> MSAA sample count (but QSurfaceFormat works too) QT_D3D_ADAPTER_INDEX=0,1,... -> D3D adapter index QT_VK_PHYSICAL_DEVICE_INDEX=0,1,... -> Vulkan physical device index QSG_RHI_UINT32_INDEX=1 -> always use uint index data (both merged/unmerged, convert when needed - with some rhi backends this is implicit) QSG_RENDER_LOOP -> to override the render loop as usual. The default with RHI is threaded for Metal, threaded for Vulkan on Windows, basic for Vulkan on Linux and Android (to be checked later), while the existing rules apply for OpenGL. Not supported when running with QRhi: - particles - compressed atlases (though this is transparent to the apps) - QSGRenderNode - QQuickRenderControl - QQuickFramebufferObject - certain QQuickWindow functionality that depends directly on OpenGL - anisotropic filtering for textures - native text may lack some gamma correction - QSGEngine applicability unclear - some QML profiler logs may be incorrect or irrelevant Change-Id: I7822e99ad79e342e4166275da6e9e66498d76521 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix leaking scene graph rendering contextsSimon Hausmann2019-03-151-2/+8
| | | | | | | | | | | | | | | | When using the threaded render loop, the rendering thread assumes ownership of the rendering context. If the rendering thread is never started, that context is leaked. This happens in tests sometimes when we create and destroy a window without waiting for exposure. So this patch maintains the ownership in the render loop for created contexts until the per-window thread is started. Task-number: QTBUG-74348 Change-Id: Ifa397fab0833c82110ac4571c1e3790351c43afd Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix more null pointer accesses in QQuickOpenGLShaderEffectMaterialCacheJüri Valdmann2018-11-121-1/+2
| | | | | | | | | This amends 6c08137faf1a53db879701126608833474a2450b. Fixes: QTBUG-71705 Change-Id: I0e9ca137c039802d348af4a29146395155e497c0 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-15/+15
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* doc: Fix remaining "Can't tie this..." errorsMartin Smith2018-02-231-8/+8
| | | | | | | | This update mostly removes qdoc comment markers from comments that should not have been qdoc comments. Change-Id: I8ccaa7fd4ae610371e25066e048fcba6cfba8038 Reviewed-by: Martin Smith <martin.smith@qt.io>
* ScenGraph: Prefer printf style loggingKai Koehne2018-02-131-68/+68
| | | | | | | | This generates more compact code, saving 20480 bytes on disk (Linux 64 bit, release build). Change-Id: I73d6d88b7b61b87a5d714e131fcf86ee80c83f38 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>