Solved Qt5 frame rate a lot slower than Qt4 in D3D app? v-sync to blame?
-
Hi,
We're developing an Windows7/8/10 application that's designed for rendering a 3D scene (kind of like a 3D modeling package ).
We've embedded our in-house build 3D renderer into the Qt application and use it to draw on a QWidget. The renderer is build on DirectX11. We use a QTimer to signal from the QtApplication to our callback every 0ms and render our 3D scene.
Our app was running fine in Qt4.8. The frame rate was smooth and clamped to 60fps. The 60fps clamp was because we were v-syncing our D3D draws.
I just switched our app to use Qt5.6.
Now, our frame rate is stuttering/choppy. I have no idea why this is. I Googled around and saw some old forum posts of people complaining about something similar (with mouse dragging behaving differently in Qt5), but they were using Qt's own OpenGL surfaces.
http://lists.qt-project.org/pipermail/development/2014-December/019401.html
Has anybody else seen similar behaviour in their applications? Is there any way to get around this problem?
Is Qt5 now doing any v-sync stuff behind the scenes that might be causing a double v-sync (one from us and one from Qt5)?
Thank you in advance for any help you can provide!
-
Hi and welcome to devnet,
I'd recommend bringing this question to the interest mailing list. You'll find there Qr's developers/maintainers. This forum is more user oriented.
-
Ah! I see.
Thank you for letting me know!
Cheers!
-
You're welcome !
Don't forget to update this thread when you can go further with your application :)
-
We found the source of the problem.
It turns out the jerkiness was caused by us calling QCursor::setPos() inside a mouse-drag event.
The reason why we were doing this was that (when the user clicks and drags the mouse on the 3D view) we force the mouse position to stay in place during the drag.
QCursor::setPos() signals out, when called.
For some reason this wasn't a problem in Qt4, but maybe something in how the events are handled in Qt5 has changed (?)
Anyhoot! We fixed the problem by removing the call to QCursor::setPos(). Now the frame rate is fine.
-
Glad you found out and thanks for sharing !
Which overload of setPos where you using ?