mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 20:58:31 +09:00
[Fix] (MG_Impl): report the draw-indirect binding and the buffer access state
Three pieces of queryable buffer state were missing, all of them read by the KHR-GL40.draw_indirect basic-binding-* and basic-buffer-* cases: - GL_DRAW_INDIRECT_BUFFER_BINDING had no case in glGetIntegerv, so it raised GL_INVALID_ENUM and left the caller's variable untouched (the test read back its own -9999 sentinel). GL_DISPATCH_INDIRECT_BUFFER_BINDING right next to it was already handled; this is the same two lines against BufferTarget::DrawIndirect. Because glGetBooleanv/glGetFloatv/glGetDoublev all widen from the integer path, one case fixes all four getters. - GL_BUFFER_ACCESS answered 0 for an unmapped buffer. Its initial value is GL_READ_WRITE and glUnmapBuffer restores it (GL 4.6 core table 6.2); 0 is not a legal value of that state at all, and the test threw on the unrecognised enum. - GL_BUFFER_ACCESS_FLAGS was not implemented, so it fell through to the invalid-pname arm. It is the MapBufferRange bitfield verbatim, which the mapping access flags already hold in normalised form - glMapBuffer's access enum is converted on the way in - so it converts straight back out, and reads zero while unmapped.
This commit is contained in:
@@ -330,12 +330,21 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
} else if (access & BufferMappingAccessBit::Write) {
|
||||
*params = GL_WRITE_ONLY;
|
||||
} else {
|
||||
*params = 0;
|
||||
*params = GL_READ_WRITE;
|
||||
}
|
||||
} else {
|
||||
*params = 0;
|
||||
// Initial value, and what glUnmapBuffer restores (GL 4.6 core table 6.2).
|
||||
*params = GL_READ_WRITE;
|
||||
}
|
||||
break;
|
||||
case GL_BUFFER_ACCESS_FLAGS:
|
||||
// The MapBufferRange flags verbatim; glMapBuffer's access enum has already been
|
||||
// normalised into the same bits. Zero while the buffer is not mapped.
|
||||
*params = bufferObject->IsMapped()
|
||||
? static_cast<GLint>(
|
||||
MG_Util::ConvertBufferMappingAccessToGLEnum(bufferObject->GetMappingAccess()))
|
||||
: 0;
|
||||
break;
|
||||
case GL_BUFFER_MAPPED:
|
||||
*params = bufferObject->IsMapped() ? GL_TRUE : GL_FALSE;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user