mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +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;
|
MG_State::GLState::FramebufferObject* lastUpdatedFBO = nullptr;
|
||||||
|
|
||||||
for (auto target : fboTargets) {
|
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) {
|
if (!currentFBO) {
|
||||||
MGLOG_E("No FBO is currently bound, cannot sync current FBO.");
|
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->SyncToBackend(currentFBO, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
backendFBOObject->Bind(target);
|
// backendFBOObject->Bind(target);
|
||||||
|
|
||||||
lastUpdatedFBO = currentFBO.get();
|
lastUpdatedFBO = currentFBO.get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -987,6 +987,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
|
|
||||||
UnorderedMap<SharedPtr<MG_State::GLState::FramebufferObject>, SharedPtr<BackendFramebufferObject>>
|
UnorderedMap<SharedPtr<MG_State::GLState::FramebufferObject>, SharedPtr<BackendFramebufferObject>>
|
||||||
g_backendFramebufferObjects;
|
g_backendFramebufferObjects;
|
||||||
|
Array<Uint16, SizeT(FramebufferTarget::FramebufferTargetCount)> g_fboBindVersions = {0};
|
||||||
} // namespace FramebufferImpl
|
} // namespace FramebufferImpl
|
||||||
|
|
||||||
namespace PrgramImpl {
|
namespace PrgramImpl {
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
|
|
||||||
extern UnorderedMap<SharedPtr<MG_State::GLState::FramebufferObject>, SharedPtr<BackendFramebufferObject>>
|
extern UnorderedMap<SharedPtr<MG_State::GLState::FramebufferObject>, SharedPtr<BackendFramebufferObject>>
|
||||||
g_backendFramebufferObjects;
|
g_backendFramebufferObjects;
|
||||||
|
extern Array<Uint16, SizeT(FramebufferTarget::FramebufferTargetCount)> g_fboBindVersions;
|
||||||
} // namespace FramebufferImpl
|
} // namespace FramebufferImpl
|
||||||
|
|
||||||
namespace PrgramImpl {
|
namespace PrgramImpl {
|
||||||
|
|||||||
Reference in New Issue
Block a user