From 8c52cd34eda592b37a58eee48a25195f72d2897f Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Tue, 8 Jul 2025 16:17:47 +0800 Subject: [PATCH] [Fix] (MG_State/Clear): set render targets before clear --- MG/MG_GL/Implementations/GL/Common/GL_Common.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MG/MG_GL/Implementations/GL/Common/GL_Common.cpp b/MG/MG_GL/Implementations/GL/Common/GL_Common.cpp index a9ea46e0..7394f947 100644 --- a/MG/MG_GL/Implementations/GL/Common/GL_Common.cpp +++ b/MG/MG_GL/Implementations/GL/Common/GL_Common.cpp @@ -24,6 +24,14 @@ namespace MG_GL::GL { MG_Diligent::GLFramebufferInfo& fbInfo = it->second; auto& commonState = *MG_State_T::commonState; + MG_Util::Debug::LogD("Setting render targets: %zu color attachments", fbInfo.ColorRTVs.size()); + MG_Diligent::g_pContext->SetRenderTargets( + static_cast(fbInfo.ColorRTVs.size()), + fbInfo.ColorRTVs.data(), + fbInfo.pDepthStencilRTV, + ::Diligent::RESOURCE_STATE_TRANSITION_MODE_TRANSITION + ); + // if (MG_Diligent::IsInRenderPass) { // MG_Util::Debug::LogD("Ending render pass before clear operation"); // MG_Diligent::g_pContext->EndRenderPass();