From c2ffa93c90bc64eab8fd1d24a6923758579318a5 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Tue, 3 Feb 2026 17:49:47 +0800 Subject: [PATCH] [Perf] (MG_Backend/DirectGLES): use version to skip unnecessary FBO sync in `BindCurrentFBO` --- MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp index 5863049b..7cafb295 100644 --- a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp +++ b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp @@ -373,7 +373,11 @@ namespace MobileGL::MG_Backend::DirectGLES { #ifdef TRACY_ENABLE ZoneScopedC(TRACY_ZONECOLOR_BACKEND); #endif - const auto& currentFBO = MG_State::pGLContext->GetFramebufferBindingSlot(target).GetBoundObject(); + auto& slot = MG_State::pGLContext->GetFramebufferBindingSlot(target); + if (slot.GetVersion() == FramebufferImpl::g_fboBindVersions[(SizeT)target]) + return; + + const auto& currentFBO = slot.GetBoundObject(); if (currentFBO && currentFBO != MG_Impl::GLImpl::FramebufferImpl::pDefaultFramebufferInfo->defaultFBO) { const auto& backendFBOIt = FramebufferImpl::g_backendFramebufferObjects.find(currentFBO); if (backendFBOIt != FramebufferImpl::g_backendFramebufferObjects.end()) {