mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 20:28:32 +09:00
[Feat] (MG_State/VertexArrayState): Add SwitchVersion for VA.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<VertexAttribute, MAX_VERTEX_ATTRIBS> m_attributes;
|
||||
Array<VertexAttributeVersion, MAX_VERTEX_ATTRIBS> m_attributeVersions; // format version, buffer version
|
||||
Array<VertexAttributeVersion, MAX_VERTEX_ATTRIBS> m_attributeVersions;
|
||||
BindingSlot<BufferObject> m_indexBufferBindingSlot;
|
||||
};
|
||||
} // namespace GLState
|
||||
|
||||
Reference in New Issue
Block a user