From d93812b0bdda537b2f59787092183a0743e1c691 Mon Sep 17 00:00:00 2001 From: nmzik Date: Sat, 5 Sep 2026 14:37:11 +0400 Subject: [PATCH] render: simplify pool wrapping and scissor clipping --- src/graphics/host_gpu/renderer/commandScheduler.cpp | 5 +---- src/graphics/host_gpu/renderer/debug.cpp | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/graphics/host_gpu/renderer/commandScheduler.cpp b/src/graphics/host_gpu/renderer/commandScheduler.cpp index f6b2db4af..101d34130 100644 --- a/src/graphics/host_gpu/renderer/commandScheduler.cpp +++ b/src/graphics/host_gpu/renderer/commandScheduler.cpp @@ -87,10 +87,7 @@ vk::CommandBuffer CommandScheduler::CommandPool::Commit() { m_ticks[*found] = m_master.CurrentTick(); } - m_hint = *found + 1; - if (m_hint == m_ticks.size()) { - m_hint = 0; - } + m_hint = (*found + 1) % m_ticks.size(); return m_buffers[*found]; } diff --git a/src/graphics/host_gpu/renderer/debug.cpp b/src/graphics/host_gpu/renderer/debug.cpp index 0b7c52067..1857800a4 100644 --- a/src/graphics/host_gpu/renderer/debug.cpp +++ b/src/graphics/host_gpu/renderer/debug.cpp @@ -895,8 +895,8 @@ static ScissorRect ScissorRectOffset(ScissorRect r, int x, int y) { } static ScissorRect ScissorRectIntersect(const ScissorRect& a, const ScissorRect& b) { - return {a.left > b.left ? a.left : b.left, a.top > b.top ? a.top : b.top, - a.right < b.right ? a.right : b.right, a.bottom < b.bottom ? a.bottom : b.bottom}; + return {std::max(a.left, b.left), std::max(a.top, b.top), + std::min(a.right, b.right), std::min(a.bottom, b.bottom)}; } static ScissorRect ScissorRectClamp(ScissorRect r, uint32_t width, uint32_t height) {