From 2fab6c5b0bd9dabcf47c0ee1181607df125d7e94 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Tue, 3 Feb 2026 02:20:48 +0800 Subject: [PATCH] [Fix] (MG_Backend/DirectGLES): Always bind VBO before glVertexAttribPointer. --- MobileGL/MG_Backend/DirectGLES/Managers.cpp | 5 ++--- .../MG_State/GLState/VertexArrayState/VertexArrayObject.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/MobileGL/MG_Backend/DirectGLES/Managers.cpp b/MobileGL/MG_Backend/DirectGLES/Managers.cpp index e12a6b69..c658fa18 100644 --- a/MobileGL/MG_Backend/DirectGLES/Managers.cpp +++ b/MobileGL/MG_Backend/DirectGLES/Managers.cpp @@ -264,9 +264,8 @@ namespace MobileGL::MG_Backend::DirectGLES { m_syncedAttributeVersions[attribIndex].BufferVersion; if (!needsSyncFormat && !needsSyncBuffer) continue; - if (needsSyncBuffer) { - SyncAttributeBuffer(attribIndex, attrib); - } + SyncAttributeBuffer(attribIndex, + attrib); // Always need to bind VBO before setting glVertexAttribPointer if (needsSyncFormat) { MG_External::GLES::glVertexAttribDivisor(attribIndex, attrib.Divisor); diff --git a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp index 0914222c..d6e8c8c7 100644 --- a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp +++ b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp @@ -29,7 +29,7 @@ namespace MobileGL { void VertexArrayObject::EnableAttribute(Uint index) { if (index >= MAX_VERTEX_ATTRIBS) return; - if (!m_attributes[index].Enabled) return; + if (m_attributes[index].Enabled) return; m_attributes[index].Enabled = true; BumpAttributeSwitchVersion(index);