mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-07 19:58:32 +09:00
[Perf] (MG_Backend/DirectGLES): use version to skip unnecessary FBO sync
This commit is contained in:
@@ -242,7 +242,12 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
MG_State::GLState::FramebufferObject* lastUpdatedFBO = nullptr;
|
||||
|
||||
for (auto target : fboTargets) {
|
||||
auto currentFBO = MG_State::pGLContext->GetFramebufferBindingSlot(target).GetBoundObject();
|
||||
auto slot = MG_State::pGLContext->GetFramebufferBindingSlot(target);
|
||||
auto version = slot.GetVersion();
|
||||
if (version == g_fboBindVersions[SizeT(target)])
|
||||
continue;
|
||||
|
||||
auto currentFBO = slot.GetBoundObject();
|
||||
|
||||
if (!currentFBO) {
|
||||
MGLOG_E("No FBO is currently bound, cannot sync current FBO.");
|
||||
@@ -269,7 +274,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
backendFBOObject->SyncToBackend(currentFBO, target);
|
||||
}
|
||||
|
||||
backendFBOObject->Bind(target);
|
||||
// backendFBOObject->Bind(target);
|
||||
|
||||
lastUpdatedFBO = currentFBO.get();
|
||||
}
|
||||
|
||||
@@ -987,6 +987,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
|
||||
UnorderedMap<SharedPtr<MG_State::GLState::FramebufferObject>, SharedPtr<BackendFramebufferObject>>
|
||||
g_backendFramebufferObjects;
|
||||
Array<Uint16, SizeT(FramebufferTarget::FramebufferTargetCount)> g_fboBindVersions = {0};
|
||||
} // namespace FramebufferImpl
|
||||
|
||||
namespace PrgramImpl {
|
||||
|
||||
@@ -170,6 +170,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
|
||||
extern UnorderedMap<SharedPtr<MG_State::GLState::FramebufferObject>, SharedPtr<BackendFramebufferObject>>
|
||||
g_backendFramebufferObjects;
|
||||
extern Array<Uint16, SizeT(FramebufferTarget::FramebufferTargetCount)> g_fboBindVersions;
|
||||
} // namespace FramebufferImpl
|
||||
|
||||
namespace PrgramImpl {
|
||||
|
||||
Reference in New Issue
Block a user