From 96ad7ca0cc14fc6ccacd01bca91dfe034364708b Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Wed, 5 Aug 2026 04:13:59 -0400 Subject: [PATCH] [Fix] (MG_Impl): asking a renderbuffer for more samples than it has is INVALID_OPERATION ValidateRenderbufferStorageSamples_State answered INVALID_VALUE for a sample count above GL_MAX_SAMPLES. GL 4.6 core 9.2.4 reserves INVALID_VALUE for a negative count: a count that is well formed but larger than the format can deliver is INVALID_OPERATION, because the argument is fine and the format is what cannot honour it. Takes direct_state_access.renderbuffers_storage_multisample_errors from failing to passing on both backends. --- MobileGL/MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MobileGL/MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.cpp b/MobileGL/MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.cpp index bed9a41f..077e58c3 100644 --- a/MobileGL/MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.cpp +++ b/MobileGL/MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.cpp @@ -625,8 +625,11 @@ namespace MobileGL::MG_Impl::GLImpl { const Int maxSamples = GetMaxRenderbufferSamples_State(); if (samples > maxSamples) { // TODO: Use per-internalformat renderbuffer sample limits once glGetInternalformativ is backed. + // GL 4.6 core 9.2.4 makes asking for more samples than the format supports + // INVALID_OPERATION, not INVALID_VALUE - the count is well formed, this format just + // cannot deliver it. Only a negative count is INVALID_VALUE. MG_State::pGLContext->RecordError( - ErrorCode::InvalidValue, + ErrorCode::InvalidOperation, MakeUnique( "MG_Impl/GLImpl", caller, std::format("Sample count {} exceeds GL_MAX_SAMPLES ({}).", samples, maxSamples)));