[Feat] (MG_State/VertexArrayState): Implement divisor.

This commit is contained in:
BZLZHH
2025-12-07 11:03:00 +08:00
parent 407d57e9b9
commit 13abb24324
2 changed files with 16 additions and 0 deletions
@@ -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
@@ -13,6 +13,7 @@ namespace MobileGL {
int Stride = 0;
SizeT Offset = 0;
Bool IsInteger = false;
Uint Divisor = 0;
SharedPtr<BufferObject> 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);