summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-09-27 15:12:19 -0700
committerKonstantin Käfer <mail@kkaefer.com>2016-09-28 10:54:48 +0200
commitaa0fc68fea8e7788d6e432ecc98395d7bdb2b540 (patch)
tree7f5cf070b753c3a59b2c7a61917bc60426408f13
parent3835ed556b03a7246d238e1ee1a52f3aac29ec98 (diff)
downloadqtlocation-mapboxgl-aa0fc68fea8e7788d6e432ecc98395d7bdb2b540.tar.gz
[core] Mark tracked state as dirty when the tracked object is destroyed
-rw-r--r--src/mbgl/gl/context.cpp27
-rw-r--r--src/mbgl/gl/state.hpp4
2 files changed, 31 insertions, 0 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index 101e11f4d8..fbe7b39a6f 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -61,6 +61,11 @@ void Context::setDirtyState() {
void Context::performCleanup() {
for (GLuint id : abandonedPrograms) {
+ for (const auto& p : abandonedPrograms) {
+ if (program == p) {
+ program.setDirty();
+ }
+ }
MBGL_CHECK_ERROR(glDeleteProgram(id));
}
abandonedPrograms.clear();
@@ -71,21 +76,43 @@ void Context::performCleanup() {
abandonedShaders.clear();
if (!abandonedBuffers.empty()) {
+ for (const auto& b : abandonedBuffers) {
+ if (vertexBuffer == b) {
+ vertexBuffer.setDirty();
+ } else if (elementBuffer == b) {
+ elementBuffer.setDirty();
+ }
+ }
MBGL_CHECK_ERROR(glDeleteBuffers(int(abandonedBuffers.size()), abandonedBuffers.data()));
abandonedBuffers.clear();
}
if (!abandonedTextures.empty()) {
+ for (const auto& t : abandonedTextures) {
+ if (activeTexture == t) {
+ activeTexture.setDirty();
+ }
+ }
MBGL_CHECK_ERROR(glDeleteTextures(int(abandonedTextures.size()), abandonedTextures.data()));
abandonedTextures.clear();
}
if (!abandonedVAOs.empty()) {
+ for (const auto& v : abandonedVAOs) {
+ if (vertexArrayObject == v) {
+ vertexArrayObject.setDirty();
+ }
+ }
MBGL_CHECK_ERROR(gl::DeleteVertexArrays(int(abandonedVAOs.size()), abandonedVAOs.data()));
abandonedVAOs.clear();
}
if (!abandonedFBOs.empty()) {
+ for (const auto& f : abandonedFBOs) {
+ if (bindFramebuffer == f) {
+ bindFramebuffer.setDirty();
+ }
+ }
MBGL_CHECK_ERROR(glDeleteFramebuffers(int(abandonedFBOs.size()), abandonedFBOs.data()));
abandonedFBOs.clear();
}
diff --git a/src/mbgl/gl/state.hpp b/src/mbgl/gl/state.hpp
index c7a7d74c63..dbb005e77d 100644
--- a/src/mbgl/gl/state.hpp
+++ b/src/mbgl/gl/state.hpp
@@ -41,6 +41,10 @@ public:
}
}
+ bool operator==(const typename T::Type& value) const {
+ return !(*this != value);
+ }
+
bool operator!=(const typename T::Type& value) const {
return dirty || currentValue != value;
}