[Perf] (MG_Backend/DirectGLES): skip redundant attachment object sync

This commit is contained in:
2026-02-04 10:42:23 +08:00
parent 2088009c01
commit f4ce17af51
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -870,12 +870,18 @@ namespace MobileGL::MG_Backend::DirectGLES {
// attach texture to fbo
// TODO: attach according to remapped
const auto& attachments = stateFBOObject->GetAllAttachmentObjects();
const auto& attachmentVersions = stateFBOObject->GetAllFramebufferAttachmentVersions();
for (SizeT i = 0; i < attachments.size(); ++i) {
const auto& attachmentObject = attachments[i];
FramebufferAttachmentType type = static_cast<FramebufferAttachmentType>(i);
// should retrieve BACKEND attachment here
GLenum glBackendAttachment = MG_Util::ConvertFramebufferAttachmentTypeToGLEnum(type);
SyncAttachmentObject(glFBOTarget, attachmentObject, glBackendAttachment);
// relevant FRONTEND!!! version should be checked and updated
if (m_syncedFrontendAttachmentVersions[i] != attachmentVersions[i]) {
SyncAttachmentObject(glFBOTarget, attachmentObject, glBackendAttachment);
m_syncedFrontendAttachmentVersions[i] = attachmentVersions[i];
}
}
}
+1 -1
View File
@@ -164,7 +164,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
GLenum m_backendReadBuffer = GL_COLOR_ATTACHMENT0;
using FramebufferObject = MG_State::GLState::FramebufferObject;
FramebufferObject::FramebufferAttachmentVersionArray m_syncedAttachmentVersions = {0};
FramebufferObject::FramebufferAttachmentVersionArray m_syncedFrontendAttachmentVersions = {0};
};
extern UnorderedMap<SharedPtr<MG_State::GLState::FramebufferObject>, SharedPtr<BackendFramebufferObject>>