[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.
This commit is contained in:
BZLZHH
2026-08-05 00:13:51 -04:00
parent d96acb7972
commit 764a44f589
@@ -112,14 +112,10 @@ namespace MobileGL::MG_Impl::GLImpl::BufferImpl {
}
Bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits) {
if (accessBits == BufferMappingAccessBit::Null) {
MG_State::pGLContext->RecordError(ErrorCode::InvalidEnum,
MakeUnique<GenericErrorInfo>("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 |