diff --git a/MobileGL/MG_Backend/DirectGLES/Managers.cpp b/MobileGL/MG_Backend/DirectGLES/Managers.cpp index 8684b92a..db099558 100644 --- a/MobileGL/MG_Backend/DirectGLES/Managers.cpp +++ b/MobileGL/MG_Backend/DirectGLES/Managers.cpp @@ -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(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]; + } } } diff --git a/MobileGL/MG_Backend/DirectGLES/Managers.h b/MobileGL/MG_Backend/DirectGLES/Managers.h index 5ae73d4d..b84c953b 100644 --- a/MobileGL/MG_Backend/DirectGLES/Managers.h +++ b/MobileGL/MG_Backend/DirectGLES/Managers.h @@ -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>