mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
[Perf] (MG_Backend/DirectGLES): Use glVertexAttribFormat to avoid redunant buffer binding.
This commit is contained in:
@@ -264,12 +264,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
m_syncedAttributeVersions[attribIndex].BufferVersion;
|
m_syncedAttributeVersions[attribIndex].BufferVersion;
|
||||||
if (!needsSyncFormat && !needsSyncBuffer) continue;
|
if (!needsSyncFormat && !needsSyncBuffer) continue;
|
||||||
|
|
||||||
SyncAttributeBuffer(attribIndex,
|
if (needsSyncBuffer) {
|
||||||
attrib); // Always need to bind VBO before setting glVertexAttribPointer
|
SyncAttributeBuffer(attribIndex, attrib);
|
||||||
|
|
||||||
if (needsSyncFormat) {
|
|
||||||
MG_External::GLES::glVertexAttribDivisor(attribIndex, attrib.Divisor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!attrib.IsInteger) {
|
if (!attrib.IsInteger) {
|
||||||
MG_External::GLES::glVertexAttribPointer(
|
MG_External::GLES::glVertexAttribPointer(
|
||||||
@@ -280,6 +276,20 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
||||||
attrib.Stride, (const void*)attrib.Offset);
|
attrib.Stride, (const void*)attrib.Offset);
|
||||||
}
|
}
|
||||||
|
continue; // No need to set format again
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needsSyncFormat) {
|
||||||
|
MG_External::GLES::glVertexAttribDivisor(attribIndex, attrib.Divisor);
|
||||||
|
if (!attrib.IsInteger) {
|
||||||
|
MG_External::GLES::glVertexAttribFormat(attribIndex, attrib.Size,
|
||||||
|
MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
||||||
|
attrib.Normalized ? GL_TRUE : GL_FALSE, attrib.Offset);
|
||||||
|
} else {
|
||||||
|
MG_External::GLES::glVertexAttribIFormat(
|
||||||
|
attribIndex, attrib.Size, MG_Util::ConvertDataTypeToGLEnum(attrib.Type), attrib.Offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint16 currentIndexBufferVersion = stateVAOObject->GetIndexBufferBindingSlot().GetVersion();
|
Uint16 currentIndexBufferVersion = stateVAOObject->GetIndexBufferBindingSlot().GetVersion();
|
||||||
|
|||||||
Reference in New Issue
Block a user