[Fix] (MG_Backend/DirectGLES): Remove the use of glVertexAttribFormat.

This commit is contained in:
BZLZHH
2026-02-05 13:30:30 +08:00
parent 9f4c9b61a0
commit 9af964de67
2 changed files with 13 additions and 27 deletions
+10 -25
View File
@@ -216,7 +216,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
MG_External::GLES::glBindVertexArray(m_backendVAOId);
}
void BackendVertexArrayObject::SyncAttributeBuffer(Uint index,
void BackendVertexArrayObject::BindAttributeBuffer(Uint index,
const MG_State::GLState::VertexAttribute& attrib) {
const auto& bufferObject = attrib.Buffer;
if (!bufferObject) {
@@ -268,35 +268,20 @@ namespace MobileGL::MG_Backend::DirectGLES {
m_syncedAttributeVersions[attribIndex].BufferVersion;
if (!needsSyncFormat && !needsSyncBuffer) continue;
if (needsSyncBuffer) {
SyncAttributeBuffer(attribIndex, attrib);
BindAttributeBuffer(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);
}
if (needsSyncFormat) {
MG_External::GLES::glVertexAttribDivisor(attribIndex, attrib.Divisor);
}
continue; // No need to set format again
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);
}
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);
}
}
}
+3 -2
View File
@@ -49,7 +49,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
void Bind();
private:
void SyncAttributeBuffer(Uint index, const MG_State::GLState::VertexAttribute& attrib);
void BindAttributeBuffer(Uint index, const MG_State::GLState::VertexAttribute& attrib);
Uint m_backendVAOId = 0;
Bool m_isInitialized = false;
@@ -132,8 +132,9 @@ namespace MobileGL::MG_Backend::DirectGLES {
bool SyncAttachmentObject(GLenum glFBOTarget,
const MG_State::GLState::FramebufferAttachmentObject& attachmentObject,
GLenum glBackendAttachment);
// FramebufferAttachmentType GetCompactedAttachmentTypeAtDrawBufferIndex(Int index);
// FramebufferAttachmentType GetCompactedAttachmentTypeAtDrawBufferIndex(Int index);
GLenum GetBackendAttachmentType(FramebufferAttachmentType frontendAtt) const;
private:
Uint m_backendFBOId = 0;