diff --git a/.gitmodules b/.gitmodules index c6895bebd..5b990ab12 100644 --- a/.gitmodules +++ b/.gitmodules @@ -49,3 +49,6 @@ [submodule "vendor/boost"] path = vendor/boost url = https://github.com/maplibre/maplibre-gl-native-boost.git +[submodule "vendor/unordered_dense"] + path = vendor/unordered_dense + url = https://github.com/martinus/unordered_dense.git diff --git a/BUILD.bazel b/BUILD.bazel index 5fed687fb..16c46b455 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -147,6 +147,7 @@ cc_library( "//vendor:polylabel", "//vendor:protozero", "//vendor:unique_resource", + "//vendor:unordered_dense", "//vendor:vector-tile", "//vendor:wagyu", ] + select({ diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d53022df..95610e261 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ option(MLN_WITH_OSMESA "Build with OSMesa (Software) renderer" OFF) option(MLN_WITH_WERROR "Make all compilation warnings errors" ON) option(MLN_LEGACY_RENDERER "Include the legacy rendering pathway" ON) option(MLN_DRAWABLE_RENDERER "Include the drawable rendering pathway" OFF) +option(MLN_USE_UNORDERED_DENSE "Use ankerl dense containers for performance" ON) if (MLN_WITH_CLANG_TIDY) find_program(CLANG_TIDY_COMMAND NAMES clang-tidy) @@ -387,6 +388,7 @@ list(APPEND INCLUDE_FILES ${PROJECT_SOURCE_DIR}/include/mbgl/util/color.hpp ${PROJECT_SOURCE_DIR}/include/mbgl/util/compression.hpp ${PROJECT_SOURCE_DIR}/include/mbgl/util/constants.hpp + ${PROJECT_SOURCE_DIR}/include/mbgl/util/containers.hpp ${PROJECT_SOURCE_DIR}/include/mbgl/util/convert.hpp ${PROJECT_SOURCE_DIR}/include/mbgl/util/default_style.hpp ${PROJECT_SOURCE_DIR}/include/mbgl/util/enum.hpp @@ -990,6 +992,7 @@ if(MLN_WITH_OPENGL) PUBLIC "MLN_LEGACY_RENDERER=$" "MLN_DRAWABLE_RENDERER=$" + "MLN_USE_UNORDERED_DENSE=$" ) list(APPEND INCLUDE_FILES @@ -1166,7 +1169,9 @@ if(MBGL_WITH_METAL) message(STATUS "Configuring Metal renderer backend") target_compile_definitions( mbgl-core - PRIVATE MBGL_RENDER_BACKEND_METAL=1 + PRIVATE + MBGL_RENDER_BACKEND_METAL=1 + "MLN_USE_UNORDERED_DENSE=$" ) list(APPEND INCLUDE_FILES @@ -1259,14 +1264,6 @@ if(MBGL_WITH_METAL) ) endif() -if(MBGL_WITH_METAL) - message(STATUS "Configuring Metal renderer backend") - target_compile_definitions( - mbgl-core - PRIVATE MBGL_RENDER_BACKEND_METAL=1 - ) -endif() - target_sources( mbgl-core PRIVATE ${INCLUDE_FILES} @@ -1324,6 +1321,16 @@ include(${PROJECT_SOURCE_DIR}/vendor/unique_resource.cmake) include(${PROJECT_SOURCE_DIR}/vendor/vector-tile.cmake) include(${PROJECT_SOURCE_DIR}/vendor/wagyu.cmake) +add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/unordered_dense) +set_target_properties( + unordered_dense + PROPERTIES + INTERFACE_MAPBOX_NAME "unordered_dense" + INTERFACE_MAPBOX_URL "https://github.com/martinus/unordered_dense" + INTERFACE_MAPBOX_AUTHOR "Martin Leitner-Ankerl" + INTERFACE_MAPBOX_LICENSE ${PROJECT_SOURCE_DIR}/vendor/unordered_dense/LICENSE +) + target_link_libraries( mbgl-core PRIVATE @@ -1350,6 +1357,7 @@ target_link_libraries( Mapbox::Base::geojson.hpp Mapbox::Base::geometry.hpp Mapbox::Base::variant + unordered_dense ) export(TARGETS @@ -1380,6 +1388,7 @@ export(TARGETS mbgl-vendor-unique_resource mbgl-vendor-vector-tile mbgl-vendor-wagyu + unordered_dense FILE MapboxCoreTargets.cmake ) @@ -1419,4 +1428,4 @@ endif() add_subdirectory(${PROJECT_SOURCE_DIR}/test) add_subdirectory(${PROJECT_SOURCE_DIR}/benchmark) -add_subdirectory(${PROJECT_SOURCE_DIR}/render-test) +add_subdirectory(${PROJECT_SOURCE_DIR}/render-test) \ No newline at end of file diff --git a/bazel/core.bzl b/bazel/core.bzl index eca6702e0..8b5f2c4b5 100644 --- a/bazel/core.bzl +++ b/bazel/core.bzl @@ -801,6 +801,7 @@ MLN_CORE_HEADERS = [ "include/mbgl/util/color.hpp", "include/mbgl/util/compression.hpp", "include/mbgl/util/constants.hpp", + "include/mbgl/util/containers.hpp", "include/mbgl/util/convert.hpp", "include/mbgl/util/default_style.hpp", "include/mbgl/util/enum.hpp", diff --git a/bazel/flags.bzl b/bazel/flags.bzl index abb18fc72..8fd0fb733 100644 --- a/bazel/flags.bzl +++ b/bazel/flags.bzl @@ -110,10 +110,12 @@ MAPLIBRE_FLAGS = select({ "/DMBGL_USE_GLES2=1", "/DMBGL_RENDER_BACKEND_OPENGL=1", "/D_USE_MATH_DEFINES", + "/DMLN_USE_UNORDERED_DENSE", ], "//conditions:default": [ "-DMBGL_USE_GLES2=1", "-DMBGL_RENDER_BACKEND_OPENGL=1", "-DGLES_SILENCE_DEPRECATION", + "-DMLN_USE_UNORDERED_DENSE", ] }) diff --git a/include/mbgl/gfx/drawable.hpp b/include/mbgl/gfx/drawable.hpp index 56a140b3f..52090e96c 100644 --- a/include/mbgl/gfx/drawable.hpp +++ b/include/mbgl/gfx/drawable.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -43,7 +44,7 @@ using Texture2DPtr = std::shared_ptr; class Drawable { public: /// @brief Map from sampler location to texture info - using Textures = std::unordered_map; + using Textures = mbgl::unordered_map; protected: Drawable(std::string name); diff --git a/include/mbgl/gfx/shader_group.hpp b/include/mbgl/gfx/shader_group.hpp index bcf67cf73..dcb9f79ee 100644 --- a/include/mbgl/gfx/shader_group.hpp +++ b/include/mbgl/gfx/shader_group.hpp @@ -1,13 +1,12 @@ #pragma once #include +#include #include #include #include #include -#include -#include namespace mbgl { @@ -147,13 +146,13 @@ public: /// @return A `gfx::ShaderPtr` virtual gfx::ShaderPtr getOrCreateShader( gfx::Context&, - [[maybe_unused]] const std::unordered_set& propertiesAsUniforms, + [[maybe_unused]] const mbgl::unordered_set& propertiesAsUniforms, [[maybe_unused]] std::string_view firstAttribName = "a_pos") { return {}; } private: - std::unordered_map> programs; + mbgl::unordered_map> programs; mutable std::shared_mutex programLock; }; diff --git a/include/mbgl/gfx/uniform_block.hpp b/include/mbgl/gfx/uniform_block.hpp index 4e5740726..e64a62133 100644 --- a/include/mbgl/gfx/uniform_block.hpp +++ b/include/mbgl/gfx/uniform_block.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -62,7 +63,7 @@ protected: /// Stores a collection of uniform blocks by name class UniformBlockArray { public: - using UniformBlockMap = std::unordered_map>; + using UniformBlockMap = mbgl::unordered_map>; /// @brief Constructor UniformBlockArray() = default; diff --git a/include/mbgl/gfx/uniform_buffer.hpp b/include/mbgl/gfx/uniform_buffer.hpp index 48a6443d7..46aeddad8 100644 --- a/include/mbgl/gfx/uniform_buffer.hpp +++ b/include/mbgl/gfx/uniform_buffer.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -48,7 +49,7 @@ protected: /// Stores a collection of uniform buffers by name class UniformBufferArray { public: - using UniformBufferMap = std::unordered_map>; + using UniformBufferMap = mbgl::unordered_map>; UniformBufferArray() = default; UniformBufferArray(UniformBufferArray&&); diff --git a/include/mbgl/gfx/vertex_attribute.hpp b/include/mbgl/gfx/vertex_attribute.hpp index ecc5805e1..97dc4d8ff 100644 --- a/include/mbgl/gfx/vertex_attribute.hpp +++ b/include/mbgl/gfx/vertex_attribute.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -10,8 +11,6 @@ #include #include #include -#include -#include #include #include @@ -281,7 +280,7 @@ protected: /// Stores a collection of vertex attributes by name class VertexAttributeArray { public: - using AttributeMap = std::unordered_map>; + using AttributeMap = mbgl::unordered_map>; VertexAttributeArray() = default; VertexAttributeArray(VertexAttributeArray&&); @@ -394,7 +393,7 @@ public: template void readDataDrivenPaintProperties(const Binders& binders, const Evaluated& evaluated, - std::unordered_set& propertiesAsUniforms) { + mbgl::unordered_set& propertiesAsUniforms) { // Read each property in the type pack propertiesAsUniforms.reserve(sizeof...(DataDrivenPaintProperty)); (readDataDrivenPaintProperty(binders.template get(), @@ -413,7 +412,7 @@ protected: template void readDataDrivenPaintProperty(const Binder& binder, const bool isConstant, - std::unordered_set& propertiesAsUniforms) { + mbgl::unordered_set& propertiesAsUniforms) { if (!binder) { return; } diff --git a/include/mbgl/mtl/command_encoder.hpp b/include/mbgl/mtl/command_encoder.hpp index 558b88f88..d098e1249 100644 --- a/include/mbgl/mtl/command_encoder.hpp +++ b/include/mbgl/mtl/command_encoder.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -65,8 +66,8 @@ protected: std::vector debugGroupNames; std::vector> renderDebugGroups; std::vector> uploadDebugGroups; - std::unordered_set renderPasses; - std::unordered_set uploadPasses; + mbgl::unordered_set renderPasses; + mbgl::unordered_set uploadPasses; }; } // namespace mtl diff --git a/include/mbgl/mtl/context.hpp b/include/mbgl/mtl/context.hpp index 7063c72b0..17cfd563b 100644 --- a/include/mbgl/mtl/context.hpp +++ b/include/mbgl/mtl/context.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -61,7 +62,7 @@ public: std::string_view vertexName, std::string_view fragmentName, const ProgramParameters& programParameters, - const std::unordered_map& additionalDefines); + const mbgl::unordered_map& additionalDefines); MTLTexturePtr createMetalTexture(MTLTextureDescriptorPtr textureDescriptor) const; MTLSamplerStatePtr createMetalSamplerState(MTLSamplerDescriptorPtr samplerDescriptor) const; diff --git a/include/mbgl/renderer/layer_tweaker.hpp b/include/mbgl/renderer/layer_tweaker.hpp index ae333a934..339785cf3 100644 --- a/include/mbgl/renderer/layer_tweaker.hpp +++ b/include/mbgl/renderer/layer_tweaker.hpp @@ -3,11 +3,11 @@ #include #include #include +#include #include #include #include -#include namespace mbgl { @@ -69,8 +69,8 @@ public: /// @brief Set the collection of attribute names which will be provided at uniform values rather than per-vertex /// attributes. /// @details These values should not have "a_" prefixes, as produced by `readDataDrivenPaintProperties`. - void setPropertiesAsUniforms(const std::unordered_set&); - const std::unordered_set& getPropertiesAsUniforms() const; + void setPropertiesAsUniforms(const mbgl::unordered_set&); + const mbgl::unordered_set& getPropertiesAsUniforms() const; void enableOverdrawInspector(bool); @@ -99,7 +99,7 @@ protected: #if MLN_RENDER_BACKEND_METAL // For Metal, whether a property is provided through attribtues or uniforms is specified in // a uniform buffer rather than by a shader compiled with different preprocessor definitions. - std::unordered_set propertiesAsUniforms; + mbgl::unordered_set propertiesAsUniforms; #endif // MLN_RENDER_BACKEND_METAL // Indicates that the evaluated properties have changed diff --git a/include/mbgl/shaders/gl/shader_group_gl.hpp b/include/mbgl/shaders/gl/shader_group_gl.hpp index 4325b5a41..e6af81320 100644 --- a/include/mbgl/shaders/gl/shader_group_gl.hpp +++ b/include/mbgl/shaders/gl/shader_group_gl.hpp @@ -5,9 +5,9 @@ #include #include #include +#include #include -#include namespace mbgl { namespace gl { @@ -21,7 +21,7 @@ public: ~ShaderGroupGL() noexcept override = default; gfx::ShaderPtr getOrCreateShader(gfx::Context& context, - const std::unordered_set& propertiesAsUniforms, + const mbgl::unordered_set& propertiesAsUniforms, std::string_view firstAttribName) override { constexpr auto& vert = shaders::ShaderSource::vertex; constexpr auto& frag = shaders::ShaderSource::fragment; diff --git a/include/mbgl/shaders/mtl/shader_group.hpp b/include/mbgl/shaders/mtl/shader_group.hpp index 214240957..6b0c3888a 100644 --- a/include/mbgl/shaders/mtl/shader_group.hpp +++ b/include/mbgl/shaders/mtl/shader_group.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,7 @@ public: ~ShaderGroup() noexcept override = default; gfx::ShaderPtr getOrCreateShader(gfx::Context& gfxContext, - const std::unordered_set& propertiesAsUniforms, + const mbgl::unordered_set& propertiesAsUniforms, std::string_view /*firstAttribName*/) override { constexpr auto& name = shaders::ShaderSource::name; constexpr auto& source = shaders::ShaderSource::source; diff --git a/include/mbgl/util/containers.hpp b/include/mbgl/util/containers.hpp new file mode 100644 index 000000000..c93bb8682 --- /dev/null +++ b/include/mbgl/util/containers.hpp @@ -0,0 +1,23 @@ +#pragma once +#if MLN_USE_UNORDERED_DENSE +#include +#else +#include +#include +#endif + +namespace mbgl { +#if MLN_USE_UNORDERED_DENSE +template +using unordered_map = ankerl::unordered_dense::map; + +template +using unordered_set = ankerl::unordered_dense::set; +#else +template +using unordered_map = std::unordered_map; + +template +using unordered_set = std::unordered_set; +#endif +} // namespace mbgl diff --git a/src/mbgl/layout/circle_layout.hpp b/src/mbgl/layout/circle_layout.hpp index 5968a80e6..72a870fce 100644 --- a/src/mbgl/layout/circle_layout.hpp +++ b/src/mbgl/layout/circle_layout.hpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace mbgl { @@ -54,7 +55,7 @@ public: void createBucket(const ImagePositions&, std::unique_ptr& featureIndex, - std::unordered_map& renderData, + mbgl::unordered_map& renderData, const bool, const bool, const CanonicalTileID& canonical) override { diff --git a/src/mbgl/layout/layout.hpp b/src/mbgl/layout/layout.hpp index c6593b00f..b91696ccd 100644 --- a/src/mbgl/layout/layout.hpp +++ b/src/mbgl/layout/layout.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include namespace mbgl { @@ -19,7 +20,7 @@ public: virtual void createBucket(const ImagePositions&, std::unique_ptr&, - std::unordered_map&, + mbgl::unordered_map&, bool, bool, const CanonicalTileID&) = 0; diff --git a/src/mbgl/layout/pattern_layout.hpp b/src/mbgl/layout/pattern_layout.hpp index 7f482728c..df1565053 100644 --- a/src/mbgl/layout/pattern_layout.hpp +++ b/src/mbgl/layout/pattern_layout.hpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace mbgl { @@ -171,7 +172,7 @@ public: void createBucket(const ImagePositions& patternPositions, std::unique_ptr& featureIndex, - std::unordered_map& renderData, + mbgl::unordered_map& renderData, const bool /*firstLoad*/, const bool /*showCollisionBoxes*/, const CanonicalTileID& canonical) override { diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index cfb3927b8..454740266 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -783,7 +784,7 @@ std::vector SymbolLayout::calculateTileDistances(const GeometryCoordinate void SymbolLayout::createBucket(const ImagePositions&, std::unique_ptr&, - std::unordered_map& renderData, + mbgl::unordered_map& renderData, const bool firstLoad, const bool showCollisionBoxes, const CanonicalTileID& canonical) { diff --git a/src/mbgl/layout/symbol_layout.hpp b/src/mbgl/layout/symbol_layout.hpp index 706acf748..12afca0c6 100644 --- a/src/mbgl/layout/symbol_layout.hpp +++ b/src/mbgl/layout/symbol_layout.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,7 @@ public: void createBucket(const ImagePositions&, std::unique_ptr&, - std::unordered_map&, + mbgl::unordered_map&, bool firstLoad, bool showCollisionBoxes, const CanonicalTileID& canonical) override; diff --git a/src/mbgl/mtl/context.cpp b/src/mbgl/mtl/context.cpp index 699ea7c09..809890e49 100644 --- a/src/mbgl/mtl/context.cpp +++ b/src/mbgl/mtl/context.cpp @@ -74,7 +74,7 @@ UniqueShaderProgram Context::createProgram(std::string name, const std::string_view vertexName, const std::string_view fragmentName, const ProgramParameters& programParameters, - const std::unordered_map& additionalDefines) { + const mbgl::unordered_map& additionalDefines) { const auto pool = NS::TransferPtr(NS::AutoreleasePool::alloc()->init()); // No NSMutableDictionary? diff --git a/src/mbgl/renderer/layer_tweaker.cpp b/src/mbgl/renderer/layer_tweaker.cpp index 85e8aa2c8..3e1315bc0 100644 --- a/src/mbgl/renderer/layer_tweaker.cpp +++ b/src/mbgl/renderer/layer_tweaker.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #if MLN_RENDER_BACKEND_METAL #include @@ -66,7 +67,7 @@ shaders::ExpressionInputsUBO LayerTweaker::buildExpressionUBO(double zoom, uint6 } #endif // MLN_RENDER_BACKEND_METAL -void LayerTweaker::setPropertiesAsUniforms([[maybe_unused]] const std::unordered_set& props) { +void LayerTweaker::setPropertiesAsUniforms([[maybe_unused]] const mbgl::unordered_set& props) { #if MLN_RENDER_BACKEND_METAL if (props != propertiesAsUniforms) { propertiesAsUniforms = props; @@ -77,11 +78,11 @@ void LayerTweaker::setPropertiesAsUniforms([[maybe_unused]] const std::unordered #if !MLN_RENDER_BACKEND_METAL namespace { -const std::unordered_set emptyIDSet; +const mbgl::unordered_set emptyIDSet; } #endif -const std::unordered_set& LayerTweaker::getPropertiesAsUniforms() const { +const mbgl::unordered_set& LayerTweaker::getPropertiesAsUniforms() const { #if MLN_RENDER_BACKEND_METAL return propertiesAsUniforms; #else diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index 5dc1dfbba..57787f3a8 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #if MLN_DRAWABLE_RENDERER #include @@ -325,7 +326,7 @@ void RenderCircleLayer::update(gfx::ShaderRegistry& shaders, [&](gfx::Drawable& drawable) { return drawable.getTileID() && !hasRenderTile(*drawable.getTileID()); }); const auto& evaluated = static_cast(*evaluatedProperties).evaluated; - std::unordered_set propertiesAsUniforms; + mbgl::unordered_set propertiesAsUniforms; for (const RenderTile& tile : *renderTiles) { const auto& tileID = tile.getOverscaledTileID(); diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index fa6dca976..e43198bb7 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -349,7 +349,7 @@ void RenderFillExtrusionLayer::update(gfx::ShaderRegistry& shaders, tileLayerGroup->setStencilTiles(renderTiles); - std::unordered_set propertiesAsUniforms; + mbgl::unordered_set propertiesAsUniforms; for (const RenderTile& tile : *renderTiles) { const auto& tileID = tile.getOverscaledTileID(); diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index c4c13e258..69420f0cd 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -491,7 +491,7 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, fillTileLayerGroup->setStencilTiles(renderTiles); - std::unordered_set propertiesAsUniforms; + mbgl::unordered_set propertiesAsUniforms; for (const RenderTile& tile : *renderTiles) { const auto& tileID = tile.getOverscaledTileID(); @@ -698,7 +698,7 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, #if MLN_TRIANGULATE_FILL_OUTLINES const auto outlineTriangulatedShader = doOutline && !dataDrivenOutline ? [&]() -> auto { - static const std::unordered_set outlinePropertiesAsUniforms{ + static const mbgl::unordered_set outlinePropertiesAsUniforms{ stringIndexer().get("a_color"), stringIndexer().get("a_opacity"), stringIndexer().get("a_width"), diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index d23ed86f2..928ccacb3 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -352,7 +352,7 @@ void RenderHeatmapLayer::update(gfx::ShaderRegistry& shaders, [&](gfx::Drawable& drawable) { return drawable.getTileID() && !hasRenderTile(*drawable.getTileID()); }); const auto& evaluated = static_cast(*evaluatedProperties).evaluated; - std::unordered_set propertiesAsUniforms; + mbgl::unordered_set propertiesAsUniforms; for (const RenderTile& tile : *renderTiles) { const auto& tileID = tile.getOverscaledTileID(); diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index 0764da1c9..f5fee4499 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -463,7 +463,7 @@ void RenderLineLayer::update(gfx::ShaderRegistry& shaders, tileLayerGroup->setStencilTiles(renderTiles); - std::unordered_set propertiesAsUniforms; + mbgl::unordered_set propertiesAsUniforms; for (const RenderTile& tile : *renderTiles) { const auto& tileID = tile.getOverscaledTileID(); diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index f50a2e16d..6344bbc01 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -749,7 +749,7 @@ SymbolDrawableTilePropsUBO buildTileUBO(const SymbolBucket& bucket, } // Convert a properties-as-uniforms set to the type expected by `SymbolDrawableData` -gfx::SymbolDrawableData::PropertyMapType toMap(const std::unordered_set& set) { +gfx::SymbolDrawableData::PropertyMapType toMap(const mbgl::unordered_set& set) { // can we do this without allocating? auto values = std::vector(set.size()); return gfx::SymbolDrawableData::PropertyMapType(set.begin(), set.end(), values.begin(), values.end()); @@ -769,7 +769,7 @@ void updateTileAttributes(const SymbolBucket::Buffer& buffer, const SymbolBucket::PaintProperties& paintProps, const SymbolPaintProperties::PossiblyEvaluated& evaluated, gfx::VertexAttributeArray& attribs, - std::unordered_set& propertiesAsUniforms) { + mbgl::unordered_set& propertiesAsUniforms) { if (const auto& attr = attribs.getOrAdd(idPosOffsetAttribName)) { attr->setSharedRawData(buffer.sharedVertices, offsetof(SymbolLayoutVertex, a1), @@ -826,7 +826,7 @@ void updateTileDrawable(gfx::Drawable& drawable, const TransformState& state, gfx::UniformBufferPtr& textInterpUBO, gfx::UniformBufferPtr& iconInterpUBO, - std::unordered_set& propertiesAsUniforms) { + mbgl::unordered_set& propertiesAsUniforms) { if (!drawable.getData()) { return; } @@ -1061,7 +1061,7 @@ void RenderSymbolLayer::update(gfx::ShaderRegistry& shaders, collisionBuilder->setColorMode(gfx::ColorMode::alphaBlended()); collisionBuilder->setVertexAttrNameId(idCollisionPosAttribName); - std::unordered_set propertiesAsUniforms; + mbgl::unordered_set propertiesAsUniforms; for (const RenderTile& tile : *renderTiles) { const auto& tileID = tile.getOverscaledTileID(); diff --git a/src/mbgl/style/layers/custom_drawable_layer.cpp b/src/mbgl/style/layers/custom_drawable_layer.cpp index 860ca6c82..03ee3e290 100644 --- a/src/mbgl/style/layers/custom_drawable_layer.cpp +++ b/src/mbgl/style/layers/custom_drawable_layer.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -364,7 +365,7 @@ void CustomDrawableLayerHost::Interface::finish() { gfx::ShaderPtr CustomDrawableLayerHost::Interface::lineShaderDefault() const { gfx::ShaderGroupPtr lineShaderGroup = shaders.getShaderGroup("LineShader"); - const std::unordered_set propertiesAsUniforms{ + const mbgl::unordered_set propertiesAsUniforms{ stringIndexer().get("a_color"), stringIndexer().get("a_blur"), stringIndexer().get("a_opacity"), @@ -379,7 +380,7 @@ gfx::ShaderPtr CustomDrawableLayerHost::Interface::lineShaderDefault() const { gfx::ShaderPtr CustomDrawableLayerHost::Interface::fillShaderDefault() const { gfx::ShaderGroupPtr fillShaderGroup = shaders.getShaderGroup("FillShader"); - const std::unordered_set propertiesAsUniforms{ + const mbgl::unordered_set propertiesAsUniforms{ stringIndexer().get("a_color"), stringIndexer().get("a_opacity"), }; diff --git a/src/mbgl/tile/geometry_tile.hpp b/src/mbgl/tile/geometry_tile.hpp index 058a33dae..23e4686ed 100644 --- a/src/mbgl/tile/geometry_tile.hpp +++ b/src/mbgl/tile/geometry_tile.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -65,14 +66,14 @@ public: class LayoutResult { public: - std::unordered_map layerRenderData; + mbgl::unordered_map layerRenderData; std::shared_ptr featureIndex; std::optional glyphAtlasImage; ImageAtlas iconAtlas; LayerRenderData* getLayerRenderData(const style::Layer::Impl&); - LayoutResult(std::unordered_map renderData_, + LayoutResult(mbgl::unordered_map renderData_, std::unique_ptr featureIndex_, std::optional glyphAtlasImage_, ImageAtlas iconAtlas_) diff --git a/src/mbgl/tile/geometry_tile_worker.hpp b/src/mbgl/tile/geometry_tile_worker.hpp index 6e5a660a0..bb169a0e8 100644 --- a/src/mbgl/tile/geometry_tile_worker.hpp +++ b/src/mbgl/tile/geometry_tile_worker.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -78,7 +79,7 @@ private: const float pixelRatio; std::unique_ptr featureIndex; - std::unordered_map renderData; + mbgl::unordered_map renderData; enum State { Idle, diff --git a/vendor/BUILD.bazel b/vendor/BUILD.bazel index b822d9eea..0d15016e4 100644 --- a/vendor/BUILD.bazel +++ b/vendor/BUILD.bazel @@ -254,3 +254,12 @@ cc_library( "nunicode-gen", ], ) + +cc_library( + name = "unordered_dense", + srcs = [], + hdrs = ["unordered_dense/include/ankerl/unordered_dense.h"], + include_prefix = "ankerl", + strip_include_prefix = "unordered_dense/include/ankerl", + visibility = ["//visibility:public"], +) diff --git a/vendor/unordered_dense b/vendor/unordered_dense new file mode 160000 index 000000000..729896c7b --- /dev/null +++ b/vendor/unordered_dense @@ -0,0 +1 @@ +Subproject commit 729896c7ba8bbd9da5573679270133086d05b5dd