summaryrefslogtreecommitdiff
path: root/src/mbgl/gfx/vertex_buffer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/gfx/vertex_buffer.hpp')
-rw-r--r--src/mbgl/gfx/vertex_buffer.hpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mbgl/gfx/vertex_buffer.hpp b/src/mbgl/gfx/vertex_buffer.hpp
index 2ed1e62759..fe98ec6505 100644
--- a/src/mbgl/gfx/vertex_buffer.hpp
+++ b/src/mbgl/gfx/vertex_buffer.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <memory>
+#include <cassert>
namespace mbgl {
namespace gfx {
@@ -17,8 +18,20 @@ public:
template <class>
class VertexBuffer {
public:
+ VertexBuffer(const std::size_t elements_, std::unique_ptr<VertexBufferResource>&& resource_)
+ : elements(elements_), resource(std::move(resource_)) {
+ }
+
std::size_t elements;
- std::unique_ptr<const VertexBufferResource> resource;
+
+ template <typename T = VertexBufferResource>
+ T& getResource() const {
+ assert(resource);
+ return static_cast<T&>(*resource);
+ }
+
+protected:
+ std::unique_ptr<VertexBufferResource> resource;
};
} // namespace gfx