Skip to content

Commit

Permalink
fix framebuffer draw
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah committed Nov 22, 2023
1 parent 2554a71 commit 32aaa6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/framework/graphics/drawpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -368,6 +369,8 @@ void DrawPool::addAction(const std::function<void()>& 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] {
Expand Down
1 change: 1 addition & 0 deletions src/framework/graphics/drawpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 32aaa6f

Please sign in to comment.