diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-03-20 10:34:02 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-03-20 15:40:47 +0100 |
commit | f86cc81680dd64f135f4f7b813c6cbb1e7e822d8 (patch) | |
tree | 566f8bb9180d43999d3b2a6a1df535e93994baf4 /src/mbgl/gl | |
parent | 1e30fdac36233c0fd0662e2b285b0424907bc81d (diff) | |
download | qtlocation-mapboxgl-f86cc81680dd64f135f4f7b813c6cbb1e7e822d8.tar.gz |
[core] move cleanup to gfx::Context
Diffstat (limited to 'src/mbgl/gl')
-rw-r--r-- | src/mbgl/gl/context.cpp | 14 | ||||
-rw-r--r-- | src/mbgl/gl/context.hpp | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index eff3c2160c..bc703db401 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -5,6 +5,7 @@ #include <mbgl/gl/texture_resource.hpp> #include <mbgl/gl/draw_scope_resource.hpp> #include <mbgl/gl/texture.hpp> +#include <mbgl/gl/debugging.hpp> #include <mbgl/gl/debugging_extension.hpp> #include <mbgl/gl/vertex_array_extension.hpp> #include <mbgl/gl/program_binary_extension.hpp> @@ -706,6 +707,19 @@ void Context::draw(const gfx::DrawMode& drawMode, } void Context::performCleanup() { + // TODO: Find a better way to unbind VAOs after we're done with them without introducing + // unnecessary bind(0)/bind(N) sequences. + { + MBGL_DEBUG_GROUP(*this, "cleanup"); + + activeTextureUnit = 1; + texture[1] = 0; + activeTextureUnit = 0; + texture[0] = 0; + + bindVertexArray = 0; + } + for (auto id : abandonedPrograms) { if (program == id) { program.setDirty(); diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 8a67213628..338a294b47 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -110,7 +110,7 @@ public: // Actually remove the objects we marked as abandoned with the above methods. // Only call this while the OpenGL context is exclusive to this thread. - void performCleanup(); + void performCleanup() 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. |