diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-03-12 16:19:37 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-03-15 10:16:16 +0100 |
commit | 20c7477fbe06ea2ce2dbecd83d475461ee03f627 (patch) | |
tree | d2116d113ca2484456686a4122615dab80d47022 | |
parent | 69e11155c839b1f2a8685331b4104f82f1aa9882 (diff) | |
download | qtlocation-mapboxgl-20c7477fbe06ea2ce2dbecd83d475461ee03f627.tar.gz |
[core] split VertexType from Vertex
-rw-r--r-- | src/mbgl/gfx/attribute.hpp | 59 | ||||
-rw-r--r-- | src/mbgl/renderer/paint_property_binder.hpp | 8 | ||||
-rw-r--r-- | test/gl/bucket.test.cpp | 2 |
3 files changed, 37 insertions, 32 deletions
diff --git a/src/mbgl/gfx/attribute.hpp b/src/mbgl/gfx/attribute.hpp index 0dce6b2a06..03b629a859 100644 --- a/src/mbgl/gfx/attribute.hpp +++ b/src/mbgl/gfx/attribute.hpp @@ -89,32 +89,32 @@ struct VertexDescriptor { namespace detail { template <class...> -struct Vertex; +struct VertexType; template <class A1> -struct Vertex<A1> { - using Type = Vertex<A1>; +struct VertexType<A1> { + using Type = VertexType<A1>; typename A1::Value a1; } MBGL_VERTEX_ALIGN; template <class A1, class A2> -struct Vertex<A1, A2> { - using Type = Vertex<A1, A2>; +struct VertexType<A1, A2> { + using Type = VertexType<A1, A2>; typename A1::Value a1; typename A2::Value a2; } MBGL_VERTEX_ALIGN; template <class A1, class A2, class A3> -struct Vertex<A1, A2, A3> { - using Type = Vertex<A1, A2, A3>; +struct VertexType<A1, A2, A3> { + using Type = VertexType<A1, A2, A3>; typename A1::Value a1; typename A2::Value a2; typename A3::Value a3; } MBGL_VERTEX_ALIGN; template <class A1, class A2, class A3, class A4> -struct Vertex<A1, A2, A3, A4> { - using Type = Vertex<A1, A2, A3, A4>; +struct VertexType<A1, A2, A3, A4> { + using Type = VertexType<A1, A2, A3, A4>; typename A1::Value a1; typename A2::Value a2; typename A3::Value a3; @@ -122,8 +122,8 @@ struct Vertex<A1, A2, A3, A4> { } MBGL_VERTEX_ALIGN; template <class A1, class A2, class A3, class A4, class A5> -struct Vertex<A1, A2, A3, A4, A5> { - using Type = Vertex<A1, A2, A3, A4, A5>; +struct VertexType<A1, A2, A3, A4, A5> { + using Type = VertexType<A1, A2, A3, A4, A5>; typename A1::Value a1; typename A2::Value a2; typename A3::Value a3; @@ -135,8 +135,8 @@ template <class> struct Descriptor; template <class A1> -struct Descriptor<Vertex<A1>> { - using Type = Vertex<A1>; +struct Descriptor<VertexType<A1>> { + using Type = VertexType<A1>; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 1, { @@ -145,11 +145,11 @@ struct Descriptor<Vertex<A1>> { }; template <class A1> -constexpr const VertexDescriptor Descriptor<Vertex<A1>>::data; +constexpr const VertexDescriptor Descriptor<VertexType<A1>>::data; template <class A1, class A2> -struct Descriptor<Vertex<A1, A2>> { - using Type = Vertex<A1, A2>; +struct Descriptor<VertexType<A1, A2>> { + using Type = VertexType<A1, A2>; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 2, { @@ -159,11 +159,11 @@ struct Descriptor<Vertex<A1, A2>> { }; template <class A1, class A2> -constexpr const VertexDescriptor Descriptor<Vertex<A1, A2>>::data; +constexpr const VertexDescriptor Descriptor<VertexType<A1, A2>>::data; template <class A1, class A2, class A3> -struct Descriptor<Vertex<A1, A2, A3>> { - using Type = Vertex<A1, A2, A3>; +struct Descriptor<VertexType<A1, A2, A3>> { + using Type = VertexType<A1, A2, A3>; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 3, { @@ -174,11 +174,11 @@ struct Descriptor<Vertex<A1, A2, A3>> { }; template <class A1, class A2, class A3> -constexpr const VertexDescriptor Descriptor<Vertex<A1, A2, A3>>::data; +constexpr const VertexDescriptor Descriptor<VertexType<A1, A2, A3>>::data; template <class A1, class A2, class A3, class A4> -struct Descriptor<Vertex<A1, A2, A3, A4>> { - using Type = Vertex<A1, A2, A3, A4>; +struct Descriptor<VertexType<A1, A2, A3, A4>> { + using Type = VertexType<A1, A2, A3, A4>; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 4, { @@ -190,11 +190,11 @@ struct Descriptor<Vertex<A1, A2, A3, A4>> { }; template <class A1, class A2, class A3, class A4> -constexpr const VertexDescriptor Descriptor<Vertex<A1, A2, A3, A4>>::data; +constexpr const VertexDescriptor Descriptor<VertexType<A1, A2, A3, A4>>::data; template <class A1, class A2, class A3, class A4, class A5> -struct Descriptor<Vertex<A1, A2, A3, A4, A5>> { - using Type = Vertex<A1, A2, A3, A4, A5>; +struct Descriptor<VertexType<A1, A2, A3, A4, A5>> { + using Type = VertexType<A1, A2, A3, A4, A5>; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 5, { @@ -207,11 +207,14 @@ struct Descriptor<Vertex<A1, A2, A3, A4, A5>> { }; template <class A1, class A2, class A3, class A4, class A5> -constexpr const VertexDescriptor Descriptor<Vertex<A1, A2, A3, A4, A5>>::data; +constexpr const VertexDescriptor Descriptor<VertexType<A1, A2, A3, A4, A5>>::data; + +template <class> +struct Vertex; template <class... As> struct Vertex<TypeList<As...>> { - using Type = Vertex<typename As::Type...>; + using Type = VertexType<typename As::Type...>; }; } // namespace detail @@ -221,6 +224,8 @@ using Vertex = typename detail::Vertex<A>::Type; template <class V> using VertexDescriptorOf = detail::Descriptor<V>; +template <class T> +using VertexType = typename detail::VertexType<T>; } // namespace gfx } // namespace mbgl diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index dc5ab6ae22..7d3e147990 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -177,7 +177,7 @@ template <class T, class A> class SourceFunctionPaintPropertyBinder final : public PaintPropertyBinder<T, T, PossiblyEvaluatedPropertyValue<T>, A> { public: using BaseAttributeType = A; - using BaseVertex = gfx::Vertex<BaseAttributeType>; + using BaseVertex = gfx::VertexType<BaseAttributeType>; using AttributeType = ZoomInterpolatedAttributeType<A>; @@ -236,7 +236,7 @@ public: using AttributeType = ZoomInterpolatedAttributeType<A>; using AttributeValue = typename AttributeType::Value; - using Vertex = gfx::Vertex<AttributeType>; + using Vertex = gfx::VertexType<AttributeType>; CompositeFunctionPaintPropertyBinder(style::PropertyExpression<T> expression_, float zoom, T defaultValue_) : expression(std::move(expression_)), @@ -308,8 +308,8 @@ public: using BaseAttributeType = A1; using BaseAttributeType2 = A2; - using Vertex = gfx::Vertex<BaseAttributeType>; - using Vertex2 = gfx::Vertex<BaseAttributeType2>; + using Vertex = gfx::VertexType<BaseAttributeType>; + using Vertex2 = gfx::VertexType<BaseAttributeType2>; CompositeCrossFadedPaintPropertyBinder(style::PropertyExpression<T> expression_, float zoom, T defaultValue_) : expression(std::move(expression_)), diff --git a/test/gl/bucket.test.cpp b/test/gl/bucket.test.cpp index 7e8740d8f9..bc9f6aac5a 100644 --- a/test/gl/bucket.test.cpp +++ b/test/gl/bucket.test.cpp @@ -26,7 +26,7 @@ namespace gfx { namespace detail { template <class A1, class A2> -bool operator==(const Vertex<A1, A2>& lhs, const Vertex<A1, A2>& rhs) { +bool operator==(const VertexType<A1, A2>& lhs, const VertexType<A1, A2>& rhs) { return std::tie(lhs.a1, lhs.a2) == std::tie(rhs.a1, rhs.a2); } |