diff options
author | Molly Lloyd <molly@mapbox.com> | 2018-08-02 15:14:19 -0700 |
---|---|---|
committer | Molly Lloyd <molly@mapbox.com> | 2018-08-27 13:13:47 -0700 |
commit | 87f1a26656437f70ddb02cb1c5513d1547314981 (patch) | |
tree | c7475c6a2fe5db5a81a0a90fbbbf96b9bdf92367 | |
parent | ff4eb32fb0cecfdd216bc0a5a4dc1a57b047e49e (diff) | |
download | qtlocation-mapboxgl-87f1a26656437f70ddb02cb1c5513d1547314981.tar.gz |
[core] expand defines for multiple uniforms
-rw-r--r-- | src/mbgl/renderer/paint_property_binder.hpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index 666334ca5f..96b1f14d3e 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -520,14 +520,25 @@ public: return result; } + template <class> + struct UniformDefines; + + template <class... Us> + struct UniformDefines<TypeList<Us...>> { + static void appendDefines(std::vector<std::string>& defines) { + util::ignore({ + (defines.push_back(std::string("#define HAS_UNIFORM_") + Us::name()), 0)... + }); + } + }; template <class EvaluatedProperties> static std::vector<std::string> defines(const EvaluatedProperties& currentProperties) { std::vector<std::string> result; util::ignore({ - (result.push_back(currentProperties.template get<Ps>().isConstant() - ? std::string("#define HAS_UNIFORM_") + Ps::Uniform::name() - : std::string()), 0)... + (currentProperties.template get<Ps>().isConstant() + ? UniformDefines<typename Ps::Uniforms>::appendDefines(result) + : (void) 0, 0)... }); return result; } |