summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-25 23:56:52 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-26 19:36:52 +0300
commitc111250fcccaf5e57154852606ee740f0db242c1 (patch)
tree82636cda8fa90be2c0e760daf806d5226331c5e0 /src/mbgl/geometry
parentb2b2797c2a30b8085683935d760c45284c639e96 (diff)
downloadqtlocation-mapboxgl-c111250fcccaf5e57154852606ee740f0db242c1.tar.gz
[core] s/operator bool/created()/ in {GL,TexturePool}Holder
Prevents confusing usage of GL holder objects.
Diffstat (limited to 'src/mbgl/geometry')
-rw-r--r--src/mbgl/geometry/buffer.hpp6
-rw-r--r--src/mbgl/geometry/glyph_atlas.cpp4
-rw-r--r--src/mbgl/geometry/line_atlas.cpp2
-rw-r--r--src/mbgl/geometry/vao.cpp4
-rw-r--r--src/mbgl/geometry/vao.hpp4
5 files changed, 11 insertions, 9 deletions
diff --git a/src/mbgl/geometry/buffer.hpp b/src/mbgl/geometry/buffer.hpp
index e8e2788f51..80fde61702 100644
--- a/src/mbgl/geometry/buffer.hpp
+++ b/src/mbgl/geometry/buffer.hpp
@@ -36,7 +36,7 @@ public:
// Transfers this buffer to the GPU and binds the buffer to the GL context.
void bind(gl::GLObjectStore& glObjectStore) {
- if (buffer) {
+ if (buffer.created()) {
MBGL_CHECK_ERROR(glBindBuffer(bufferType, getID()));
} else {
buffer.create(glObjectStore);
@@ -65,7 +65,7 @@ public:
// Uploads the buffer to the GPU to be available when we need it.
inline void upload(gl::GLObjectStore& glObjectStore) {
- if (!buffer) {
+ if (!buffer.created()) {
bind(glObjectStore);
}
}
@@ -73,7 +73,7 @@ public:
protected:
// increase the buffer size by at least /required/ bytes.
inline void *addElement() {
- if (buffer) {
+ if (buffer.created()) {
throw std::runtime_error("Can't add elements after buffer was bound to GPU");
}
if (length < pos + itemSize) {
diff --git a/src/mbgl/geometry/glyph_atlas.cpp b/src/mbgl/geometry/glyph_atlas.cpp
index fd43fb8c18..1b0f4bc7e4 100644
--- a/src/mbgl/geometry/glyph_atlas.cpp
+++ b/src/mbgl/geometry/glyph_atlas.cpp
@@ -144,7 +144,7 @@ void GlyphAtlas::removeGlyphs(uintptr_t tileUID) {
void GlyphAtlas::upload(gl::GLObjectStore& glObjectStore) {
if (dirty) {
- const bool first = !texture;
+ const bool first = !texture.created();
bind(glObjectStore);
std::lock_guard<std::mutex> lock(mtx);
@@ -184,7 +184,7 @@ void GlyphAtlas::upload(gl::GLObjectStore& glObjectStore) {
}
void GlyphAtlas::bind(gl::GLObjectStore& glObjectStore) {
- if (!texture) {
+ if (!texture.created()) {
texture.create(glObjectStore);
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture.getID()));
#ifndef GL_ES_VERSION_2_0
diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp
index 1213b8d778..614e3280c7 100644
--- a/src/mbgl/geometry/line_atlas.cpp
+++ b/src/mbgl/geometry/line_atlas.cpp
@@ -129,7 +129,7 @@ void LineAtlas::upload(gl::GLObjectStore& glObjectStore) {
void LineAtlas::bind(gl::GLObjectStore& glObjectStore) {
bool first = false;
- if (!texture) {
+ if (!texture.created()) {
texture.create(glObjectStore);
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture.getID()));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
diff --git a/src/mbgl/geometry/vao.cpp b/src/mbgl/geometry/vao.cpp
index 8239604264..c438fbd2e6 100644
--- a/src/mbgl/geometry/vao.cpp
+++ b/src/mbgl/geometry/vao.cpp
@@ -26,7 +26,9 @@ void VertexArrayObject::bindVertexArrayObject(gl::GLObjectStore& glObjectStore)
return;
}
- if (!vao) vao.create(glObjectStore);
+ if (!vao.created()) {
+ vao.create(glObjectStore);
+ }
MBGL_CHECK_ERROR(gl::BindVertexArray(vao.getID()));
}
diff --git a/src/mbgl/geometry/vao.hpp b/src/mbgl/geometry/vao.hpp
index 8e9e417c1c..8bc3750590 100644
--- a/src/mbgl/geometry/vao.hpp
+++ b/src/mbgl/geometry/vao.hpp
@@ -24,7 +24,7 @@ public:
if (bound_shader == 0) {
vertexBuffer.bind(glObjectStore);
shader.bind(offset);
- if (vao) {
+ if (vao.created()) {
storeBinding(shader, vertexBuffer.getID(), 0, offset);
}
} else {
@@ -39,7 +39,7 @@ public:
vertexBuffer.bind(glObjectStore);
elementsBuffer.bind(glObjectStore);
shader.bind(offset);
- if (vao) {
+ if (vao.created()) {
storeBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset);
}
} else {