[Interest] Low frame rate in rendering custom opengl code in Qt Quick

Nuno Santos nuno.santos at imaginando.pt
Wed Jan 5 09:27:19 CET 2022


Daljit,

Try this simple hack.

Put in scene a qml item with an infinite animation like a bouncing rectangle. This will force the window to render. See if this makes any difference. If my theory is correct, simply moving the mouse on top of the window will also make the rendering happen more often.

If any of this hacks work, it means that since there is nothing happening on the window and it is not being painted. You might need a custom animation driver instead of the qml animation hack as a proper solution: 

There is an interesting Qt blog post that makes use of a custom animation driver:

https://www.qt.io/blog/2017/02/21/making-movies-qml <https://www.qt.io/blog/2017/02/21/making-movies-qml>

Regards,

Nuno

> On 5 Jan 2022, at 02:04, Daljit Singh <daljit97 at live.com> wrote:
> 
> Hi, I'm using a third party library (Skia) to render custom opengl code in sync with the QtQuick Scene Graph (Qt 5.15 on Windows 11).
> I'm using the QQuickFramebufferObject and QSGRenderNode classes to create custom QQuickItems to render my scene. The approach works fine, but I've come across a very strange issue that I'm unable to solve. The problem consists in a sudden unrecoverable drop in FPS during the rendering of my scene. I've noticed that the issue presents itself whenever the rendering frame time jumps above a certain threshold (most of the times my app is able to render at 60fps, but there are times when there is a lot of content to render). When this happens, the frame rate no longer jumps back to 60 fps as expected, but instead is remains weirdly low (less than 10 fps) for the remaning time of the session. This is despite the fact on subsequent draw calls I render nothing in my opengl scene. 
> Doing some logging with the helper logging categories provided by Qt, I can see that the scene graph that the render time is fine most of the time, but the logs consistently report an unusally high sync time in the threaded render loop. An example log message shows (other frame logs show similar times):
>  
> > Debug: time in renderer: total=4ms, preprocess=0, updates=0, binding=0, rendering=4 (scenegraph\coreapi\qsgrenderer.cpp:281, void __cdecl QSGRenderer::renderScene(const class QSGBindable &))
> > Debug: Frame rendered with 'threaded' renderloop in 134ms, sync=129, render=4, swap=1 - (on render thread) (scenegraph\qsgthreadedrenderloop.cpp:902, void __cdecl QSGRenderThread::syncAndRender(class QImage *))
>  
> Has anyone got any clue about what might be going here?
>  
> Best Regards,
> Daljit
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org <mailto:Interest at qt-project.org>
> https://lists.qt-project.org/listinfo/interest <https://lists.qt-project.org/listinfo/interest>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220105/4d65393d/attachment-0001.htm>


More information about the Interest mailing list