mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Fix] (MG_Backend/DirectGLES): Remove the use of glVertexAttribFormat.
This commit is contained in:
@@ -216,7 +216,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
MG_External::GLES::glBindVertexArray(m_backendVAOId);
|
MG_External::GLES::glBindVertexArray(m_backendVAOId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackendVertexArrayObject::SyncAttributeBuffer(Uint index,
|
void BackendVertexArrayObject::BindAttributeBuffer(Uint index,
|
||||||
const MG_State::GLState::VertexAttribute& attrib) {
|
const MG_State::GLState::VertexAttribute& attrib) {
|
||||||
const auto& bufferObject = attrib.Buffer;
|
const auto& bufferObject = attrib.Buffer;
|
||||||
if (!bufferObject) {
|
if (!bufferObject) {
|
||||||
@@ -268,35 +268,20 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
m_syncedAttributeVersions[attribIndex].BufferVersion;
|
m_syncedAttributeVersions[attribIndex].BufferVersion;
|
||||||
if (!needsSyncFormat && !needsSyncBuffer) continue;
|
if (!needsSyncFormat && !needsSyncBuffer) continue;
|
||||||
|
|
||||||
if (needsSyncBuffer) {
|
BindAttributeBuffer(attribIndex, attrib);
|
||||||
SyncAttributeBuffer(attribIndex, attrib);
|
|
||||||
|
|
||||||
if (!attrib.IsInteger) {
|
if (!attrib.IsInteger) {
|
||||||
MG_External::GLES::glVertexAttribPointer(
|
MG_External::GLES::glVertexAttribPointer(
|
||||||
attribIndex, attrib.Size, MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
attribIndex, attrib.Size, MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
||||||
attrib.Normalized ? GL_TRUE : GL_FALSE, attrib.Stride, (const void*)attrib.Offset);
|
attrib.Normalized ? GL_TRUE : GL_FALSE, attrib.Stride, (const void*)attrib.Offset);
|
||||||
} else {
|
} else {
|
||||||
MG_External::GLES::glVertexAttribIPointer(attribIndex, attrib.Size,
|
MG_External::GLES::glVertexAttribIPointer(attribIndex, attrib.Size,
|
||||||
MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
MG_Util::ConvertDataTypeToGLEnum(attrib.Type),
|
||||||
attrib.Stride, (const void*)attrib.Offset);
|
attrib.Stride, (const void*)attrib.Offset);
|
||||||
}
|
|
||||||
|
|
||||||
if (needsSyncFormat) {
|
|
||||||
MG_External::GLES::glVertexAttribDivisor(attribIndex, attrib.Divisor);
|
|
||||||
}
|
|
||||||
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,
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
void Bind();
|
void Bind();
|
||||||
|
|
||||||
private:
|
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;
|
Uint m_backendVAOId = 0;
|
||||||
Bool m_isInitialized = false;
|
Bool m_isInitialized = false;
|
||||||
@@ -132,8 +132,9 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
bool SyncAttachmentObject(GLenum glFBOTarget,
|
bool SyncAttachmentObject(GLenum glFBOTarget,
|
||||||
const MG_State::GLState::FramebufferAttachmentObject& attachmentObject,
|
const MG_State::GLState::FramebufferAttachmentObject& attachmentObject,
|
||||||
GLenum glBackendAttachment);
|
GLenum glBackendAttachment);
|
||||||
// FramebufferAttachmentType GetCompactedAttachmentTypeAtDrawBufferIndex(Int index);
|
// FramebufferAttachmentType GetCompactedAttachmentTypeAtDrawBufferIndex(Int index);
|
||||||
GLenum GetBackendAttachmentType(FramebufferAttachmentType frontendAtt) const;
|
GLenum GetBackendAttachmentType(FramebufferAttachmentType frontendAtt) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Uint m_backendFBOId = 0;
|
Uint m_backendFBOId = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user