diff --git a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp index 507955bb..e75c58b0 100644 --- a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp +++ b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp @@ -29,13 +29,13 @@ namespace MobileGL { void VertexArrayObject::EnableAttribute(Uint index) { if (index >= MAX_VERTEX_ATTRIBS) return; m_attributes[index].Enabled = true; - BumpAttributeFormatVersion(index); + BumpAttributeSwitchVersion(index); } void VertexArrayObject::DisableAttribute(Uint index) { if (index >= MAX_VERTEX_ATTRIBS) return; m_attributes[index].Enabled = false; - BumpAttributeFormatVersion(index); + BumpAttributeSwitchVersion(index); } Bool VertexArrayObject::IsAttributeEnabled(Uint index) const { @@ -109,6 +109,11 @@ namespace MobileGL { ++m_attributeVersions[index].BufferVersion; } + void VertexArrayObject::BumpAttributeSwitchVersion(Uint index) { + if (index >= MAX_VERTEX_ATTRIBS) return; + ++m_attributeVersions[index].SwitchVersion; + } + const VertexAttributeVersion& VertexArrayObject::GetAttributeVersion(Uint index) const { static VertexAttributeVersion emptyVersion; if (index >= MAX_VERTEX_ATTRIBS) return emptyVersion; diff --git a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.h b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.h index ccb8b5c1..93f6aa47 100644 --- a/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.h +++ b/MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.h @@ -29,6 +29,7 @@ namespace MobileGL { struct VertexAttributeVersion { Uint16 FormatVersion = 0; Uint16 BufferVersion = 0; + Uint16 SwitchVersion = 0; }; class VertexArrayObject { @@ -62,10 +63,11 @@ namespace MobileGL { private: void BumpAttributeFormatVersion(Uint index); void BumpAttributeBufferVersion(Uint index); + void BumpAttributeSwitchVersion(Uint index); const Uint m_externalIndex = 0; Array m_attributes; - Array m_attributeVersions; // format version, buffer version + Array m_attributeVersions; BindingSlot m_indexBufferBindingSlot; }; } // namespace GLState