mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Perf] (MG_Backend/DirectGLES): Use glVertexAttribFormat to avoid redunant buffer binding.
This commit is contained in:
@@ -264,21 +264,31 @@ 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 (!attrib.IsInteger) {
|
||||||
|
MG_External::GLES::glVertexAttribPointer(
|
||||||
|
attribIndex, attrib.Size, MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
||||||
|
attrib.Normalized ? GL_TRUE : GL_FALSE, attrib.Stride, (const void*)attrib.Offset);
|
||||||
|
} else {
|
||||||
|
MG_External::GLES::glVertexAttribIPointer(attribIndex, attrib.Size,
|
||||||
|
MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
||||||
|
attrib.Stride, (const void*)attrib.Offset);
|
||||||
|
}
|
||||||
|
continue; // No need to set format again
|
||||||
|
}
|
||||||
|
|
||||||
if (needsSyncFormat) {
|
if (needsSyncFormat) {
|
||||||
MG_External::GLES::glVertexAttribDivisor(attribIndex, attrib.Divisor);
|
MG_External::GLES::glVertexAttribDivisor(attribIndex, attrib.Divisor);
|
||||||
}
|
if (!attrib.IsInteger) {
|
||||||
|
MG_External::GLES::glVertexAttribFormat(attribIndex, attrib.Size,
|
||||||
if (!attrib.IsInteger) {
|
MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
||||||
MG_External::GLES::glVertexAttribPointer(
|
attrib.Normalized ? GL_TRUE : GL_FALSE, attrib.Offset);
|
||||||
attribIndex, attrib.Size, MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
} else {
|
||||||
attrib.Normalized ? GL_TRUE : GL_FALSE, attrib.Stride, (const void*)attrib.Offset);
|
MG_External::GLES::glVertexAttribIFormat(
|
||||||
} else {
|
attribIndex, attrib.Size, MG_Util::ConvertDataTypeToGLEnum(attrib.Type), attrib.Offset);
|
||||||
MG_External::GLES::glVertexAttribIPointer(attribIndex, attrib.Size,
|
}
|
||||||
MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
|
||||||
attrib.Stride, (const void*)attrib.Offset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user