diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-03-05 18:36:41 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-03-06 16:12:51 +0100 |
commit | 3a57aa65d75af0d71bda9c1bde8fe8118ce7c7d1 (patch) | |
tree | 5e5e149094a45a1b3b0457b2f698661c66741428 /src/mbgl/gl/attribute.hpp | |
parent | 4737a45383911fcddf93f0a33e7e25246a5da07e (diff) | |
download | qtlocation-mapboxgl-3a57aa65d75af0d71bda9c1bde8fe8118ce7c7d1.tar.gz |
[core] move VertexBuffer<> to gfx namespace
Diffstat (limited to 'src/mbgl/gl/attribute.hpp')
-rw-r--r-- | src/mbgl/gl/attribute.hpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp index 53ba71a89f..dc112c1ad8 100644 --- a/src/mbgl/gl/attribute.hpp +++ b/src/mbgl/gl/attribute.hpp @@ -2,7 +2,7 @@ #include <mbgl/gfx/attribute.hpp> #include <mbgl/gl/types.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/util/ignore.hpp> #include <mbgl/util/indexed_tuple.hpp> #include <mbgl/util/optional.hpp> @@ -22,13 +22,14 @@ class AttributeBinding { public: gfx::AttributeDescriptor attribute; uint8_t vertexStride; - BufferID vertexBuffer; + const gfx::VertexBufferResource* vertexBufferResource; uint32_t vertexOffset; - friend bool operator==(const AttributeBinding& lhs, - const AttributeBinding& rhs) { - return std::tie(lhs.attribute, lhs.vertexStride, lhs.vertexBuffer, lhs.vertexOffset) - == std::tie(rhs.attribute, rhs.vertexStride, rhs.vertexBuffer, rhs.vertexOffset); + friend bool operator==(const AttributeBinding& lhs, const AttributeBinding& rhs) { + return lhs.attribute == rhs.attribute && + lhs.vertexStride == rhs.vertexStride && + lhs.vertexBufferResource == rhs.vertexBufferResource && + lhs.vertexOffset == rhs.vertexOffset; } }; @@ -40,12 +41,12 @@ using AttributeBindingArray = std::vector<optional<AttributeBinding>>; a buffer with only one float for each vertex can be bound to a `vec2` attribute */ template <std::size_t I, typename Vertex> -AttributeBinding attributeBinding(const VertexBuffer<Vertex>& buffer) { +AttributeBinding attributeBinding(const gfx::VertexBuffer<Vertex>& buffer) { static_assert(I < gfx::VertexDescriptorOf<Vertex>::data.count, "vertex attribute index out of range"); return { gfx::VertexDescriptorOf<Vertex>::data.attributes[I], gfx::VertexDescriptorOf<Vertex>::data.stride, - buffer.buffer, + buffer.resource.get(), 0, }; } @@ -106,7 +107,7 @@ public: return result; } - static Bindings bindings(const VertexBuffer<gfx::Vertex<Types>>& buffer) { + static Bindings bindings(const gfx::VertexBuffer<gfx::Vertex<Types>>& buffer) { return Bindings { attributeBinding<TypeIndex<As, As...>::value>(buffer)... }; } |