Drawable Renderer (#1570), warnings

This commit is contained in:
Tim Sylvester
2023-05-11 12:18:19 -07:00
committed by Bart Louwers
parent 7dc90ae627
commit 81461bc357
2 changed files with 8 additions and 1 deletions

View File

@@ -14,5 +14,12 @@ MBGL_CONSTEXPR std::array<To, Size> convert(const std::array<From, Size>& from)
return to;
}
template <typename To, typename From, std::size_t Size, typename = std::enable_if_t<std::is_assignable_v<To&, From>>>
MBGL_CONSTEXPR std::array<To, Size> cast(const std::array<From, Size>& from) {
std::array<To, Size> to{{}};
std::transform(std::begin(from), std::end(from), std::begin(to), [](From x){ return static_cast<To>(x); });
return to;
}
} // namespace util
} // namespace mbgl

View File

@@ -241,7 +241,7 @@ void Renderer::Impl::render(const RenderTree& renderTree) {
}
gfx::DrawableUBO drawableUBO;
drawableUBO.matrix = util::convert<float>(matrix);
drawableUBO.matrix = util::cast<float>(matrix);
auto uniformBuffer = context.createUniformBuffer(&drawableUBO, sizeof(drawableUBO));
drawable.mutableUniformBuffers().addOrReplace("DrawableUBO", uniformBuffer);