From ce91218b420cd9e57a3367679300f8ba4027d6c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 12 Jun 2019 17:25:44 +0200 Subject: [core] don't call glFlush on every frame --- src/mbgl/gl/context.cpp | 6 ++++++ src/mbgl/gl/context.hpp | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src/mbgl/gl') diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 3e88624d4f..4d9c2055de 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -682,7 +682,13 @@ void Context::performCleanup() { abandonedRenderbuffers.data())); abandonedRenderbuffers.clear(); } +} + +void Context::reduceMemoryUsage() { + performCleanup(); + // Ensure that all pending actions are executed to ensure that they happen before the app goes + // to the background. MBGL_CHECK_ERROR(glFinish()); } diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 80278718d1..70f12e5a8d 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -96,6 +96,8 @@ public: // Only call this while the OpenGL context is exclusive to this thread. void performCleanup() override; + void reduceMemoryUsage() override; + // Drain pools and remove abandoned objects, in preparation for destroying the store. // Only call this while the OpenGL context is exclusive to this thread. void reset(); -- cgit v1.2.1