[Feat] (MG_Impl/VertexArrayState): Allow VAO at index 0.

This commit is contained in:
BZLZHH
2025-10-31 14:40:47 +08:00
parent 731281eb61
commit d36e42103b
3 changed files with 4 additions and 13 deletions
@@ -107,7 +107,7 @@ namespace MobileGL {
return; return;
} }
if (!VertexArrayImpl::ValidateVertexArrayName(array, true)) return; if (!VertexArrayImpl::ValidateVertexArrayName(array)) return;
if (!MG_State::pGLContext->ValidateVertexArrayObject(array)) { if (!MG_State::pGLContext->ValidateVertexArrayObject(array)) {
MG_State::pGLContext->CreateVertexArrayObject(array); MG_State::pGLContext->CreateVertexArrayObject(array);
@@ -128,7 +128,7 @@ namespace MobileGL {
GLuint vao = arrays[i]; GLuint vao = arrays[i];
if (vao == 0) continue; if (vao == 0) continue;
if (!VertexArrayImpl::ValidateVertexArrayName(vao, true)) continue; if (!VertexArrayImpl::ValidateVertexArrayName(vao)) continue;
if (MG_State::pGLContext->GetBoundVertexArray() && if (MG_State::pGLContext->GetBoundVertexArray() &&
MG_State::pGLContext->GetBoundVertexArray() == MG_State::pGLContext->GetVertexArrayObject(vao)) { MG_State::pGLContext->GetBoundVertexArray() == MG_State::pGLContext->GetVertexArrayObject(vao)) {
@@ -7,16 +7,7 @@
namespace MobileGL::MG_Impl::GLImpl { namespace MobileGL::MG_Impl::GLImpl {
namespace VertexArrayImpl { namespace VertexArrayImpl {
Bool ValidateVertexArrayName(Uint index, Bool allowZero) { Bool ValidateVertexArrayName(Uint index) {
if (index == 0) {
if (allowZero) return true;
MG_State::pGLContext->RecordError(
ErrorCode::InvalidValue, MakeShared<GenericErrorInfo>("MG_Impl/GLImpl", "ValidateVertexArrayName",
"Vertex array name 0 is not supported."));
return false;
}
Bool isValid = MG_State::pGLContext->ValidateVertexArrayName(index); Bool isValid = MG_State::pGLContext->ValidateVertexArrayName(index);
if (!isValid) { if (!isValid) {
MG_State::pGLContext->RecordError( MG_State::pGLContext->RecordError(
@@ -4,7 +4,7 @@
namespace MobileGL::MG_Impl::GLImpl { namespace MobileGL::MG_Impl::GLImpl {
namespace VertexArrayImpl { namespace VertexArrayImpl {
Bool ValidateVertexArrayName(Uint index, Bool allowZero = false); Bool ValidateVertexArrayName(Uint index);
Bool ValidateVertexArrayObject(Uint index); Bool ValidateVertexArrayObject(Uint index);
Bool ValidateVertexAttributeIndex(Uint index); Bool ValidateVertexAttributeIndex(Uint index);
Bool ValidateVertexAttribPointerParams(Uint index, SizeT size, DataType type, Int stride); Bool ValidateVertexAttribPointerParams(Uint index, SizeT size, DataType type, Int stride);