From 9db24e6593228780b2fc8670017b46df350f7856 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Tue, 8 Jul 2025 14:32:25 +0800 Subject: [PATCH] [Optimization] (Diligent/Framebuffer): explicitly unbind framebuffer on texture copy (BlitFramebuffer) --- MG/MG_GL/Implementations/GL/Framebuffer/GL_Framebuffer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MG/MG_GL/Implementations/GL/Framebuffer/GL_Framebuffer.cpp b/MG/MG_GL/Implementations/GL/Framebuffer/GL_Framebuffer.cpp index 7b86794c..b1768d67 100644 --- a/MG/MG_GL/Implementations/GL/Framebuffer/GL_Framebuffer.cpp +++ b/MG/MG_GL/Implementations/GL/Framebuffer/GL_Framebuffer.cpp @@ -521,6 +521,9 @@ namespace MG_GL::GL { // MG_Diligent::IsInRenderPass = false; // MG_Util::Debug::LogD("Current render pass ended."); // } + + // explicitly unbind the texture + MG_Diligent::g_pContext->SetRenderTargets(0, nullptr, nullptr, Diligent::RESOURCE_STATE_TRANSITION_MODE_NONE); GLuint readFB = MG_State_T::framebufferState->currentBindings_[GL_READ_FRAMEBUFFER]; GLuint drawFB = MG_State_T::framebufferState->currentBindings_[GL_DRAW_FRAMEBUFFER];