summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/rhi/hellominimalcrossgfxtriangle/window.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/manual/rhi/hellominimalcrossgfxtriangle/window.cpp b/tests/manual/rhi/hellominimalcrossgfxtriangle/window.cpp
index 153bd2c37f..2a3475538d 100644
--- a/tests/manual/rhi/hellominimalcrossgfxtriangle/window.cpp
+++ b/tests/manual/rhi/hellominimalcrossgfxtriangle/window.cpp
@@ -3,6 +3,7 @@
#include "window.h"
#include <QPlatformSurfaceEvent>
+#include <QTimer>
Window::Window(QRhi::Implementation graphicsApi)
: m_graphicsApi(graphicsApi)
@@ -196,7 +197,20 @@ void Window::render()
m_rhi->endFrame(m_sc.get());
+ // Always request the next frame via requestUpdate(). On some platforms this is backed
+ // by a platform-specific solution, e.g. CVDisplayLink on macOS, which is potentially
+ // more efficient than a timer, queued metacalls, etc.
+ //
+ // However, the rendering behavior is identical no matter how the next round of
+ // rendering is triggered: the rendering thread is throttled to the presentation rate
+ // (either in beginFrame() or endFrame()) so the triangle should rotate at the exact
+ // same speed no matter which approach is taken here.
+
+#if 1
requestUpdate();
+#else
+ QTimer::singleShot(0, this, [this] { render(); });
+#endif
}
void Window::customInit()