From 947a1c8f5c858806c3f2b72fc70241b4a7fda5bc Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 17 Dec 2022 00:21:07 -0800 Subject: [PATCH] Qt: Refactor and fix dequeueAll so keep mode keeps last draw tex too --- src/platform/qt/DisplayGL.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/platform/qt/DisplayGL.cpp b/src/platform/qt/DisplayGL.cpp index 3b1c2a695..59a441aca 100644 --- a/src/platform/qt/DisplayGL.cpp +++ b/src/platform/qt/DisplayGL.cpp @@ -861,17 +861,23 @@ void PainterGL::dequeueAll(bool keep) { m_free.append(buffer); } } - m_queueTex.clear(); - m_freeTex.clear(); - for (auto tex : m_bridgeTexes) { - m_freeTex.enqueue(tex); - } - m_bridgeTexIn = m_freeTex.dequeue(); - m_bridgeTexOut = std::numeric_limits::max(); if (m_buffer && !keep) { m_free.append(m_buffer); m_buffer = nullptr; } + + m_queueTex.clear(); + m_freeTex.clear(); + for (auto tex : m_bridgeTexes) { + if (keep && tex == m_bridgeTexIn) { + continue; + } + m_freeTex.enqueue(tex); + } + if (!keep) { + m_bridgeTexIn = m_freeTex.dequeue(); + m_bridgeTexOut = std::numeric_limits::max(); + } } void PainterGL::setVideoProxy(std::shared_ptr proxy) {