diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-03 11:48:50 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-05 10:52:19 -0700 |
commit | 9cf57e7142f0e7b599de0f851cd6178d5a6a4c25 (patch) | |
tree | 185fbfaf15cc55a996731060b92bb24c87ad4378 /src/mbgl/gl | |
parent | e4310aa87489c2db52d7ff65f71e51cc6c9700b6 (diff) | |
download | qtlocation-mapboxgl-9cf57e7142f0e7b599de0f851cd6178d5a6a4c25.tar.gz |
[core] Make ElementGroup safer
Template on shader types, rather than count. This allows the compiler to enforce using the correct VAO for the shader and PaintMode. This fixes OverdrawMode with circle layers.
While here, avoid using unique_ptrs for groups. Instead, ensure ElementGroup is movable.
Diffstat (limited to 'src/mbgl/gl')
-rw-r--r-- | src/mbgl/gl/element_group.hpp | 25 | ||||
-rw-r--r-- | src/mbgl/gl/vao.cpp | 5 | ||||
-rw-r--r-- | src/mbgl/gl/vao.hpp | 6 |
3 files changed, 1 insertions, 35 deletions
diff --git a/src/mbgl/gl/element_group.hpp b/src/mbgl/gl/element_group.hpp deleted file mode 100644 index f99a03b679..0000000000 --- a/src/mbgl/gl/element_group.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include <mbgl/gl/vao.hpp> -#include <mbgl/util/noncopyable.hpp> - -#include <array> - -namespace mbgl { -namespace gl { - -template <uint8_t count> -struct ElementGroup : public util::noncopyable { - std::array<VertexArrayObject, count> array; - uint32_t vertex_length; - uint32_t elements_length; - - ElementGroup(uint32_t vertex_length_ = 0, uint32_t elements_length_ = 0) - : vertex_length(vertex_length_) - , elements_length(elements_length_) - { - } -}; - -} // namespace gl -} // namespace mbgl diff --git a/src/mbgl/gl/vao.cpp b/src/mbgl/gl/vao.cpp index 87c03ac23e..b235b0e63b 100644 --- a/src/mbgl/gl/vao.cpp +++ b/src/mbgl/gl/vao.cpp @@ -7,11 +7,6 @@ namespace mbgl { namespace gl { -VertexArrayObject::VertexArrayObject() { -} - -VertexArrayObject::~VertexArrayObject() = default; - void VertexArrayObject::bindVertexArrayObject(Context& context) { if (!GenVertexArrays || !BindVertexArray) { static bool reported = false; diff --git a/src/mbgl/gl/vao.hpp b/src/mbgl/gl/vao.hpp index 6a5e7d0e60..826c028d32 100644 --- a/src/mbgl/gl/vao.hpp +++ b/src/mbgl/gl/vao.hpp @@ -3,7 +3,6 @@ #include <mbgl/gl/shader.hpp> #include <mbgl/gl/context.hpp> #include <mbgl/gl/vertex_buffer.hpp> -#include <mbgl/util/noncopyable.hpp> #include <mbgl/util/optional.hpp> #include <stdexcept> @@ -11,11 +10,8 @@ namespace mbgl { namespace gl { -class VertexArrayObject : public util::noncopyable { +class VertexArrayObject { public: - VertexArrayObject(); - ~VertexArrayObject(); - template <typename Shader, typename T> void bind(Shader& shader, const VertexBuffer<T>& vertexBuffer, |