From 20c7477fbe06ea2ce2dbecd83d475461ee03f627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 12 Mar 2019 16:19:37 +0100 Subject: [core] split VertexType from Vertex --- src/mbgl/gfx/attribute.hpp | 59 ++++++++++++++++------------- src/mbgl/renderer/paint_property_binder.hpp | 8 ++-- 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 -struct Vertex; +struct VertexType; template -struct Vertex { - using Type = Vertex; +struct VertexType { + using Type = VertexType; typename A1::Value a1; } MBGL_VERTEX_ALIGN; template -struct Vertex { - using Type = Vertex; +struct VertexType { + using Type = VertexType; typename A1::Value a1; typename A2::Value a2; } MBGL_VERTEX_ALIGN; template -struct Vertex { - using Type = Vertex; +struct VertexType { + using Type = VertexType; typename A1::Value a1; typename A2::Value a2; typename A3::Value a3; } MBGL_VERTEX_ALIGN; template -struct Vertex { - using Type = Vertex; +struct VertexType { + using Type = VertexType; typename A1::Value a1; typename A2::Value a2; typename A3::Value a3; @@ -122,8 +122,8 @@ struct Vertex { } MBGL_VERTEX_ALIGN; template -struct Vertex { - using Type = Vertex; +struct VertexType { + using Type = VertexType; typename A1::Value a1; typename A2::Value a2; typename A3::Value a3; @@ -135,8 +135,8 @@ template struct Descriptor; template -struct Descriptor> { - using Type = Vertex; +struct Descriptor> { + using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 1, { @@ -145,11 +145,11 @@ struct Descriptor> { }; template -constexpr const VertexDescriptor Descriptor>::data; +constexpr const VertexDescriptor Descriptor>::data; template -struct Descriptor> { - using Type = Vertex; +struct Descriptor> { + using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 2, { @@ -159,11 +159,11 @@ struct Descriptor> { }; template -constexpr const VertexDescriptor Descriptor>::data; +constexpr const VertexDescriptor Descriptor>::data; template -struct Descriptor> { - using Type = Vertex; +struct Descriptor> { + using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 3, { @@ -174,11 +174,11 @@ struct Descriptor> { }; template -constexpr const VertexDescriptor Descriptor>::data; +constexpr const VertexDescriptor Descriptor>::data; template -struct Descriptor> { - using Type = Vertex; +struct Descriptor> { + using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 4, { @@ -190,11 +190,11 @@ struct Descriptor> { }; template -constexpr const VertexDescriptor Descriptor>::data; +constexpr const VertexDescriptor Descriptor>::data; template -struct Descriptor> { - using Type = Vertex; +struct Descriptor> { + using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 5, { @@ -207,11 +207,14 @@ struct Descriptor> { }; template -constexpr const VertexDescriptor Descriptor>::data; +constexpr const VertexDescriptor Descriptor>::data; + +template +struct Vertex; template struct Vertex> { - using Type = Vertex; + using Type = VertexType; }; } // namespace detail @@ -221,6 +224,8 @@ using Vertex = typename detail::Vertex::Type; template using VertexDescriptorOf = detail::Descriptor; +template +using VertexType = typename detail::VertexType; } // 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 SourceFunctionPaintPropertyBinder final : public PaintPropertyBinder, A> { public: using BaseAttributeType = A; - using BaseVertex = gfx::Vertex; + using BaseVertex = gfx::VertexType; using AttributeType = ZoomInterpolatedAttributeType; @@ -236,7 +236,7 @@ public: using AttributeType = ZoomInterpolatedAttributeType; using AttributeValue = typename AttributeType::Value; - using Vertex = gfx::Vertex; + using Vertex = gfx::VertexType; CompositeFunctionPaintPropertyBinder(style::PropertyExpression expression_, float zoom, T defaultValue_) : expression(std::move(expression_)), @@ -308,8 +308,8 @@ public: using BaseAttributeType = A1; using BaseAttributeType2 = A2; - using Vertex = gfx::Vertex; - using Vertex2 = gfx::Vertex; + using Vertex = gfx::VertexType; + using Vertex2 = gfx::VertexType; CompositeCrossFadedPaintPropertyBinder(style::PropertyExpression 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 -bool operator==(const Vertex& lhs, const Vertex& rhs) { +bool operator==(const VertexType& lhs, const VertexType& rhs) { return std::tie(lhs.a1, lhs.a2) == std::tie(rhs.a1, rhs.a2); } -- cgit v1.2.1