From 32aaa6f394ed47c645cf48fbc79dc5c7163f4005 Mon Sep 17 00:00:00 2001 From: Renato Machado Date: Wed, 22 Nov 2023 17:35:36 -0300 Subject: [PATCH] fix framebuffer draw --- src/framework/graphics/drawpool.cpp | 7 +++++-- src/framework/graphics/drawpool.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/framework/graphics/drawpool.cpp b/src/framework/graphics/drawpool.cpp index 272e89f37d..1e4bba1e06 100644 --- a/src/framework/graphics/drawpool.cpp +++ b/src/framework/graphics/drawpool.cpp @@ -160,8 +160,8 @@ void DrawPool::updateHash(const DrawPool::DrawMethod& method, const TexturePtr& if (m_state.transformMatrix != DEFAULT_MATRIX3) stdext::hash_union(m_state.hash, m_state.transformMatrix.hash()); - if (m_bindedFramebuffers > 0) - stdext::hash_combine(m_state.hash, m_bindedFramebuffers); + if (m_bindedFramebuffers) + stdext::hash_combine(m_state.hash, m_lastFramebufferId); if (color != Color::white) stdext::hash_union(m_state.hash, color.hash()); @@ -251,6 +251,7 @@ void DrawPool::resetState() m_state = {}; m_depthLevel = 0; m_status.second = 0; + m_lastFramebufferId = 0; m_shaderRefreshDelay = 0; m_scale = PlatformWindow::DEFAULT_DISPLAY_DENSITY; } @@ -368,6 +369,8 @@ void DrawPool::addAction(const std::function& action) void DrawPool::bindFrameBuffer(const Size& size) { ++m_bindedFramebuffers; + ++m_lastFramebufferId; + m_oldState = std::move(m_state); m_state = {}; addAction([size, frameIndex = m_bindedFramebuffers, drawState = m_state] { diff --git a/src/framework/graphics/drawpool.h b/src/framework/graphics/drawpool.h index 5b56266ef4..8bbb5d5946 100644 --- a/src/framework/graphics/drawpool.h +++ b/src/framework/graphics/drawpool.h @@ -234,6 +234,7 @@ class DrawPool uint16_t m_refreshDelay{ 0 }, m_shaderRefreshDelay{ 0 }; uint32_t m_onlyOnceStateFlag{ 0 }; + uint_fast64_t m_lastFramebufferId{ 0 }; PoolState m_state, m_oldState;