summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMolly Lloyd <molly@mapbox.com>2018-04-05 18:41:06 -0700
committerMolly Lloyd <molly@mapbox.com>2018-04-05 18:50:42 -0700
commit8ab0a8ef31a6efbd262a7b7d309f64dc4f80b052 (patch)
treebe39e4c0f51552add558e0022aa80f490408da62
parent553efa38e3591ce62863d4d74222710f8e3c2337 (diff)
downloadqtlocation-mapboxgl-8ab0a8ef31a6efbd262a7b7d309f64dc4f80b052.tar.gz
[core] add recursive concatenation to Uniforms and Attributes
-rw-r--r--src/mbgl/gl/attribute.hpp16
-rw-r--r--src/mbgl/gl/uniform.hpp16
2 files changed, 24 insertions, 8 deletions
diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp
index fa6c2ddeab..329b761df6 100644
--- a/src/mbgl/gl/attribute.hpp
+++ b/src/mbgl/gl/attribute.hpp
@@ -296,17 +296,25 @@ namespace detail {
template <class...>
struct ConcatenateAttributes;
+template <>
+struct ConcatenateAttributes<> {
+ using Type = Attributes<>;
+};
+
template <class... As, class... Bs>
struct ConcatenateAttributes<TypeList<As...>, TypeList<Bs...>> {
using Type = Attributes<As..., Bs...>;
};
+template <class... As, class... Bs, class... RemainingTypeLists>
+struct ConcatenateAttributes<TypeList<As...>, TypeList<Bs...>, RemainingTypeLists...> {
+ using Type = typename ConcatenateAttributes<TypeList<As..., Bs...>, RemainingTypeLists...>::Type;
+};
+
} // namespace detail
-template <class A, class B>
-using ConcatenateAttributes = typename detail::ConcatenateAttributes<
- typename A::Types,
- typename B::Types>::Type;
+template <class... As> // gl:Attributes...
+using ConcatenateAttributes = typename detail::ConcatenateAttributes<typename As::Types...>::Type;
} // namespace gl
} // namespace mbgl
diff --git a/src/mbgl/gl/uniform.hpp b/src/mbgl/gl/uniform.hpp
index 5a78068fc8..768725f3a9 100644
--- a/src/mbgl/gl/uniform.hpp
+++ b/src/mbgl/gl/uniform.hpp
@@ -126,17 +126,25 @@ namespace detail {
template <class...>
struct ConcatenateUniforms;
+template <>
+struct ConcatenateUniforms<> {
+ using Type = Uniforms<>;
+};
+
template <class... As, class... Bs>
struct ConcatenateUniforms<TypeList<As...>, TypeList<Bs...>> {
using Type = Uniforms<As..., Bs...>;
};
+template <class... As, class... Bs, class... RemainingTypeLists>
+struct ConcatenateUniforms<TypeList<As...>, TypeList<Bs...>, RemainingTypeLists...> {
+ using Type = typename ConcatenateUniforms<TypeList<As..., Bs...>, RemainingTypeLists...>::Type;
+};
+
} // namespace detail
-template <class A, class B>
-using ConcatenateUniforms = typename detail::ConcatenateUniforms<
- typename A::Types,
- typename B::Types>::Type;
+template <class... Us>
+using ConcatenateUniforms = typename detail::ConcatenateUniforms<typename Us::Types...>::Type;
} // namespace gl
} // namespace mbgl