core: Add a m_presented assert in OutputFrame::presented()

presented() must be called at most once.
This commit is contained in:
Vlad Zahorodnii 2024-08-23 15:00:31 +03:00
parent 35d4ac716c
commit 5276801d5e

View file

@ -87,11 +87,13 @@ std::optional<RenderTimeSpan> OutputFrame::queryRenderTime() const
void OutputFrame::presented(std::chrono::nanoseconds timestamp, PresentationMode mode) void OutputFrame::presented(std::chrono::nanoseconds timestamp, PresentationMode mode)
{ {
Q_ASSERT(!m_presented);
m_presented = true;
const auto renderTime = queryRenderTime(); const auto renderTime = queryRenderTime();
if (m_loop) { if (m_loop) {
RenderLoopPrivate::get(m_loop)->notifyFrameCompleted(timestamp, renderTime, mode, this); RenderLoopPrivate::get(m_loop)->notifyFrameCompleted(timestamp, renderTime, mode, this);
} }
m_presented = true;
for (const auto &feedback : m_feedbacks) { for (const auto &feedback : m_feedbacks) {
feedback->presented(m_refreshDuration, timestamp, mode); feedback->presented(m_refreshDuration, timestamp, mode);
} }