From 764a44f5895cdc9177970ce11e990bac39c34313 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Wed, 5 Aug 2026 00:13:51 -0400 Subject: [PATCH] [Fix] (MG_Impl): stop treating an empty buffer mapping access mask as a bad enum glMapBufferRange and glMapNamedBufferRange rejected an access of zero with INVALID_ENUM. Zero is a perfectly well-formed bitfield value - it contains no invalid flags - and what it violates is the separate rule that a mapping has to ask for read or write access, which GL reports as INVALID_OPERATION. Both callers already checked that rule immediately after, so the validator was reporting the wrong error for a case its callers were about to handle correctly. direct_state_access.buffers_errors passes, which puts the whole buffers group at 4 of 4 on both backends. --- MobileGL/MG_Impl/GLImpl/Buffer/Validators.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/MobileGL/MG_Impl/GLImpl/Buffer/Validators.cpp b/MobileGL/MG_Impl/GLImpl/Buffer/Validators.cpp index 9ee2f134..0282d559 100644 --- a/MobileGL/MG_Impl/GLImpl/Buffer/Validators.cpp +++ b/MobileGL/MG_Impl/GLImpl/Buffer/Validators.cpp @@ -112,14 +112,10 @@ namespace MobileGL::MG_Impl::GLImpl::BufferImpl { } Bool ValidateBufferMappingAccess(Flags accessBits) { - if (accessBits == BufferMappingAccessBit::Null) { - MG_State::pGLContext->RecordError(ErrorCode::InvalidEnum, - MakeUnique("MG_Impl/GLImpl/BufferImpl", - "ValidateBufferMappingAccess", - "Access bits cannot be null.")); - return false; - } - + // An empty mask is a legal value for a bitfield - it just fails the rule that a mapping + // must ask for read or write access, which is INVALID_OPERATION and belongs to the callers + // (both of them check it immediately after this). Rejecting it here as INVALID_ENUM + // reported the wrong error and hid theirs. const auto validBits = BufferMappingAccessBit::Read | BufferMappingAccessBit::Write | BufferMappingAccessBit::InvalidateRange | BufferMappingAccessBit::InvalidateBuffer | BufferMappingAccessBit::FlushExplicit | BufferMappingAccessBit::Unsynchronized |