mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (MG_Impl, MG_State): implement the DSA vertex array queries
glGetVertexArrayiv, glGetVertexArrayIndexediv and glGetVertexArrayIndexed64iv were stubs, so nothing could read a vertex array's state without binding it first -- the exact thing direct state access exists to avoid. They read the state the vertex array already holds. Two accessors were needed for that: the relative offset and the binding points, which are the binding-point view the flat per-attribute state was resolved from and cannot be reconstructed from the resolved form. Note the index means different things by entry point: for the 32-bit indexed query it is an attribute, but GL_VERTEX_BINDING_OFFSET names a vertex buffer binding point directly (GL 4.6 core 10.3.1). GL_VERTEX_ATTRIB_ARRAY_LONG is answered GL_FALSE throughout, which is honest while 64-bit vertex attributes are unsupported. Takes direct_state_access.vertex_arrays_* from 8 to 12 of 19 on Espryt. GL_VERTEX_BINDING_OFFSET still reads back 0: the query is right but the offset is not reaching the binding point, which is a separate defect further up.
This commit is contained in:
@@ -84,6 +84,21 @@ namespace MobileGL {
|
||||
void SetAttributeFormatSeparate(Uint attribIndex, int size, DataType type, Bool normalized,
|
||||
Bool isInteger, Uint relativeOffset);
|
||||
|
||||
// The binding-point view the attributes were resolved from. Kept queryable
|
||||
// because glGetVertexArrayIndexed[64]iv reports it verbatim, and the resolved
|
||||
// flat attribute cannot always be inverted back into it.
|
||||
Uint GetAttributeRelativeOffset(Uint attribIndex) const {
|
||||
return attribIndex < m_attributeRelativeOffset.size() ? m_attributeRelativeOffset[attribIndex] : 0;
|
||||
}
|
||||
Uint GetAttributeBindingIndex(Uint attribIndex) const {
|
||||
return attribIndex < m_attributeBindingIndex.size() ? m_attributeBindingIndex[attribIndex]
|
||||
: attribIndex;
|
||||
}
|
||||
const VertexBufferBindingPoint& GetBindingPoint(Uint bindingIndex) const {
|
||||
static const VertexBufferBindingPoint kEmpty{};
|
||||
return bindingIndex < m_bindingPoints.size() ? m_bindingPoints[bindingIndex] : kEmpty;
|
||||
}
|
||||
|
||||
const VertexAttributeVersion& GetAttributeVersion(Uint index) const;
|
||||
const Array<VertexAttributeVersion, MAX_VERTEX_ATTRIBS>& GetAllAttributeVersions() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user