From 13abb24324c075506c429fc31e4943e5b24e2bab Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Sun, 7 Dec 2025 11:01:30 +0800 Subject: [PATCH] [Feat] (MG_State/VertexArrayState): Implement divisor. --- .../GLState/VertexArrayState/VertexArrayObject.cpp | 12 ++++++++++++ .../GLState/VertexArrayState/VertexArrayObject.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp index ee9d24e8..c5231df8 100644 --- a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp +++ b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp @@ -94,6 +94,18 @@ namespace MobileGL { Uint VertexArrayObject::GetExternalIndex() const { return m_externalIndex; } + + void VertexArrayObject::SetAttributeDivisor(Uint index, Uint divisor) { + if (index >= MAX_VERTEX_ATTRIBS) return; + if (m_attributes[index].Divisor == divisor) return; + m_attributes[index].Divisor = divisor; + MarkAttributeDirty(index); + } + + Uint VertexArrayObject::GetAttributeDivisor(Uint index) const { + if (index >= MAX_VERTEX_ATTRIBS) return 0; + return m_attributes[index].Divisor; + } } // namespace GLState } // namespace MG_State } // namespace MobileGL diff --git a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.h b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.h index 76135add..63374fc4 100644 --- a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.h +++ b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.h @@ -13,6 +13,7 @@ namespace MobileGL { int Stride = 0; SizeT Offset = 0; Bool IsInteger = false; + Uint Divisor = 0; SharedPtr Buffer; }; @@ -40,6 +41,9 @@ namespace MobileGL { void ClearDirtyAttributes(); Uint GetExternalIndex() const; + void SetAttributeDivisor(Uint index, Uint divisor); + Uint GetAttributeDivisor(Uint index) const; + private: void MarkAttributeDirty(Uint index);