From 4407be89cd6359da77d46b8022682e8e676cb20b Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Sat, 1 Aug 2026 02:50:29 -0400 Subject: [PATCH] [Fix] (MG_Impl): count multisample texture attachments in GL_SAMPLE_BUFFERS The draw-framebuffer sample resolver only looked at renderbuffer attachments, so framebuffers with multisample texture attachments reported GL_SAMPLE_BUFFERS == 0 and callers took single-sampled paths (the CTS blit helpers read multisampled attachments based on it). --- MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp b/MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp index 934e4b99..f9a4e11f 100644 --- a/MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp +++ b/MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp @@ -213,8 +213,13 @@ namespace MobileGL::MG_Impl::GLImpl { GLint maxSamples = 0; for (const auto& attachment : drawFbo->GetAllAttachmentObjects()) { - if (!attachment.IsRenderbuffer() || !attachment.GetRenderbuffer()) continue; - maxSamples = std::max(maxSamples, static_cast(attachment.GetRenderbuffer()->GetSamples())); + if (attachment.IsRenderbuffer() && attachment.GetRenderbuffer()) { + maxSamples = std::max(maxSamples, static_cast(attachment.GetRenderbuffer()->GetSamples())); + } else if (attachment.IsTexture() && attachment.GetTexture()) { + // Multisample texture attachments count too (GL_SAMPLE_BUFFERS must + // report 1 for any multisampled draw framebuffer). + maxSamples = std::max(maxSamples, static_cast(attachment.GetTexture()->GetSamples())); + } } return maxSamples; }