summaryrefslogtreecommitdiff
path: root/src/mbgl/gl
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-01 15:28:59 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-01 15:28:59 +0300
commit31753583da2553584596a9c1abdff8af4a551426 (patch)
tree63ef8aa29be713e60ad14ccee3e82a78bf6f4530 /src/mbgl/gl
parent1b0683b94c070d14bc9f2cf357e551cdbbf3043a (diff)
downloadqtlocation-mapboxgl-31753583da2553584596a9c1abdff8af4a551426.tar.gz
[test] Added GL objects tests
Diffstat (limited to 'src/mbgl/gl')
-rw-r--r--src/mbgl/gl/gl_config.hpp14
-rw-r--r--src/mbgl/gl/object_store.hpp8
2 files changed, 19 insertions, 3 deletions
diff --git a/src/mbgl/gl/gl_config.hpp b/src/mbgl/gl/gl_config.hpp
index 7b42c7829f..66f4406530 100644
--- a/src/mbgl/gl/gl_config.hpp
+++ b/src/mbgl/gl/gl_config.hpp
@@ -12,7 +12,7 @@ namespace gl {
template <typename T>
class Value {
public:
- inline void operator=(const typename T::Type& value) {
+ void operator=(const typename T::Type& value) {
if (dirty || current != value) {
dirty = false;
current = value;
@@ -20,16 +20,24 @@ public:
}
}
- inline void reset() {
+ void reset() {
dirty = true;
current = T::Default;
T::Set(current);
}
- inline void setDirty() {
+ void setDirty() {
dirty = true;
}
+ typename T::Type getCurrent() {
+ return current;
+ }
+
+ bool getDirty() {
+ return dirty;
+ }
+
private:
typename T::Type current = T::Default;
bool dirty = false;
diff --git a/src/mbgl/gl/object_store.hpp b/src/mbgl/gl/object_store.hpp
index 8c798f1688..a7b1993b5a 100644
--- a/src/mbgl/gl/object_store.hpp
+++ b/src/mbgl/gl/object_store.hpp
@@ -96,6 +96,14 @@ public:
// Only call this while the OpenGL context is exclusive to this thread.
void performCleanup();
+ bool empty() const {
+ return abandonedPrograms.empty()
+ && abandonedShaders.empty()
+ && abandonedBuffers.empty()
+ && abandonedTextures.empty()
+ && abandonedVAOs.empty();
+ }
+
private:
friend ProgramDeleter;
friend ShaderDeleter;