summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-02-08 15:57:58 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-02-10 18:04:45 -0600
commit0bbc6b814cbec44be7026a0bac83d56e4d71a287 (patch)
treea35b1729e934cccc0b8f537c2618d16c125ddb3e /src
parent0b3873c7b55699117d0c61891c32c69baf196c14 (diff)
downloadqtlocation-mapboxgl-0bbc6b814cbec44be7026a0bac83d56e4d71a287.tar.gz
[core] Restore support for GL implementations without VAO extension
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/gl/context.cpp14
-rw-r--r--src/mbgl/gl/context.hpp4
-rw-r--r--src/mbgl/gl/segment.hpp15
3 files changed, 23 insertions, 10 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index a74e941bc6..5726eca5dc 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -123,12 +123,16 @@ UniqueTexture Context::createTexture() {
}
UniqueVertexArray Context::createVertexArray() {
- if (!gl::GenVertexArrays) {
- throw std::runtime_error("GL_ARB_vertex_array_object extension is required");
- }
-
VertexArrayID id = 0;
- MBGL_CHECK_ERROR(gl::GenVertexArrays(1, &id));
+ if (gl::GenVertexArrays && !disableVAOExtension) {
+ MBGL_CHECK_ERROR(gl::GenVertexArrays(1, &id));
+ } else {
+ static bool reported = false;
+ if (!reported) {
+ Log::Warning(Event::OpenGL, "Not using Vertex Array Objects");
+ reported = true;
+ }
+ }
return UniqueVertexArray(std::move(id), { this });
}
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index 636dfc9eac..d1be794240 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -222,6 +222,10 @@ private:
std::vector<VertexArrayID> abandonedVertexArrays;
std::vector<FramebufferID> abandonedFramebuffers;
std::vector<RenderbufferID> abandonedRenderbuffers;
+
+public:
+ // For testing
+ bool disableVAOExtension = false;
};
} // namespace gl
diff --git a/src/mbgl/gl/segment.hpp b/src/mbgl/gl/segment.hpp
index bb9f2f1ee8..7ce90e53a6 100644
--- a/src/mbgl/gl/segment.hpp
+++ b/src/mbgl/gl/segment.hpp
@@ -37,12 +37,17 @@ public:
context.vertexBuffer.setDirty();
}
- context.vertexArrayObject = *vao;
-
- if (indexBuffer != indexBuffer_) {
- indexBuffer = indexBuffer_;
- context.elementBuffer.setDirty();
+ if (*vao) {
+ context.vertexArrayObject = *vao;
+ if (indexBuffer != indexBuffer_) {
+ indexBuffer = indexBuffer_;
+ context.elementBuffer.setDirty();
+ context.elementBuffer = indexBuffer_;
+ }
+ } else {
+ // No VAO support. Force attributes to be rebound.
context.elementBuffer = indexBuffer_;
+ variableBindings = {};
}
Attributes::bind(context,