[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.
This commit is contained in:
BZLZHH
2026-08-05 04:13:59 -04:00
parent e80a23eae6
commit 96ad7ca0cc
@@ -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<GenericErrorInfo>(
"MG_Impl/GLImpl", caller,
std::format("Sample count {} exceeds GL_MAX_SAMPLES ({}).", samples, maxSamples)));