From d1f0aa3d393e2b4234cade7e7a11cbca59b3db82 Mon Sep 17 00:00:00 2001 From: Gopmyc Date: Sat, 2 May 2026 18:44:23 +0200 Subject: [PATCH 1/3] fix(rendering): avoid redundant framebuffer resize reallocations --- Sources/OvEditor/src/OvEditor/Panels/AView.cpp | 7 ++++++- .../src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp | 7 +++++++ .../src/OvRendering/HAL/OpenGL/GLRenderbuffer.cpp | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Sources/OvEditor/src/OvEditor/Panels/AView.cpp b/Sources/OvEditor/src/OvEditor/Panels/AView.cpp index 898ef55b5..4ff363be5 100644 --- a/Sources/OvEditor/src/OvEditor/Panels/AView.cpp +++ b/Sources/OvEditor/src/OvEditor/Panels/AView.cpp @@ -62,7 +62,12 @@ void OvEditor::Panels::AView::Render() { FrameMarkStart(name.c_str()); - m_framebuffer.Resize(winWidth, winHeight); + auto [framebufferWidth, framebufferHeight] = m_framebuffer.GetSize(); + + if (framebufferWidth != winWidth || framebufferHeight != winHeight) + { + m_framebuffer.Resize(winWidth, winHeight); + } InitFrame(); diff --git a/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp b/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp index ae75c5a28..0146f87c2 100644 --- a/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp +++ b/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp @@ -149,6 +149,13 @@ void OvRendering::HAL::GLFramebuffer::Resize(uint16_t p_width, uint16_t p_height { OVASSERT(IsValid(), "Cannot resize an invalid framebuffer"); + auto [currentWidth, currentHeight] = GetSize(); + + if (currentWidth == p_width && currentHeight == p_height) + { + return; + } + for (auto& attachment : m_context.attachments) { if (const auto pval = std::get_if>(&attachment.second); pval && *pval) diff --git a/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLRenderbuffer.cpp b/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLRenderbuffer.cpp index ea6232eba..dd7c9efd2 100644 --- a/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLRenderbuffer.cpp +++ b/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLRenderbuffer.cpp @@ -62,6 +62,12 @@ template<> void OvRendering::HAL::GLRenderbuffer::Resize(uint16_t p_width, uint16_t p_height) { OVASSERT(IsValid(), "Cannot resize a renderbuffer that has not been allocated"); + + if (m_context.width == p_width && m_context.height == p_height) + { + return; + } + Allocate(p_width, p_height, m_context.format); } From 623f74dbdcc64637f401ab6f0dbe96d3656bc24a Mon Sep 17 00:00:00 2001 From: Gopmyc Date: Sat, 2 May 2026 18:44:28 +0200 Subject: [PATCH 2/3] fix(rendering): correct height comparison in texture resize --- Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLTexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLTexture.cpp b/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLTexture.cpp index 8cdd31e38..0b734e4b2 100644 --- a/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLTexture.cpp +++ b/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLTexture.cpp @@ -178,7 +178,7 @@ void OvRendering::HAL::GLTexture::Resize(uint32_t p_width, uint32_t p_height) auto& desc = m_textureContext.desc; - if (p_width != desc.width || p_height != desc.width) + if (p_width != desc.width || p_height != desc.height) { desc.width = p_width; desc.height = p_height; From a5ff8f51ea466aa2a8db448373c83cd2f5c16277 Mon Sep 17 00:00:00 2001 From: Gopmyc Date: Sat, 2 May 2026 20:11:35 +0200 Subject: [PATCH 3/3] chore(review): remove redundant framebuffer resize checks --- Sources/OvEditor/src/OvEditor/Panels/AView.cpp | 7 +------ .../src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp | 7 ------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Sources/OvEditor/src/OvEditor/Panels/AView.cpp b/Sources/OvEditor/src/OvEditor/Panels/AView.cpp index 4ff363be5..898ef55b5 100644 --- a/Sources/OvEditor/src/OvEditor/Panels/AView.cpp +++ b/Sources/OvEditor/src/OvEditor/Panels/AView.cpp @@ -62,12 +62,7 @@ void OvEditor::Panels::AView::Render() { FrameMarkStart(name.c_str()); - auto [framebufferWidth, framebufferHeight] = m_framebuffer.GetSize(); - - if (framebufferWidth != winWidth || framebufferHeight != winHeight) - { - m_framebuffer.Resize(winWidth, winHeight); - } + m_framebuffer.Resize(winWidth, winHeight); InitFrame(); diff --git a/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp b/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp index 0146f87c2..ae75c5a28 100644 --- a/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp +++ b/Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLFramebuffer.cpp @@ -149,13 +149,6 @@ void OvRendering::HAL::GLFramebuffer::Resize(uint16_t p_width, uint16_t p_height { OVASSERT(IsValid(), "Cannot resize an invalid framebuffer"); - auto [currentWidth, currentHeight] = GetSize(); - - if (currentWidth == p_width && currentHeight == p_height) - { - return; - } - for (auto& attachment : m_context.attachments) { if (const auto pval = std::get_if>(&attachment.second); pval && *pval)