Add ankerl::unordered_dense containers (#1881)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
mwilsnd
2023-11-27 14:06:01 -05:00
committed by GitHub
parent 71d4ceabcd
commit 04d5695a0a
34 changed files with 119 additions and 56 deletions

3
.gitmodules vendored
View File

@@ -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

View File

@@ -147,6 +147,7 @@ cc_library(
"//vendor:polylabel",
"//vendor:protozero",
"//vendor:unique_resource",
"//vendor:unordered_dense",
"//vendor:vector-tile",
"//vendor:wagyu",
] + select({

View File

@@ -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=$<BOOL:${MLN_LEGACY_RENDERER}>"
"MLN_DRAWABLE_RENDERER=$<BOOL:${MLN_DRAWABLE_RENDERER}>"
"MLN_USE_UNORDERED_DENSE=$<BOOL:${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=$<BOOL:${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)

View File

@@ -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",

View File

@@ -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",
]
})

View File

@@ -7,6 +7,7 @@
#include <mbgl/util/color.hpp>
#include <mbgl/util/identity.hpp>
#include <mbgl/util/traits.hpp>
#include <mbgl/util/containers.hpp>
#include <cstdint>
#include <cstddef>
@@ -43,7 +44,7 @@ using Texture2DPtr = std::shared_ptr<Texture2D>;
class Drawable {
public:
/// @brief Map from sampler location to texture info
using Textures = std::unordered_map<int32_t, gfx::Texture2DPtr>;
using Textures = mbgl::unordered_map<int32_t, gfx::Texture2DPtr>;
protected:
Drawable(std::string name);

View File

@@ -1,13 +1,12 @@
#pragma once
#include <mbgl/gfx/shader.hpp>
#include <mbgl/util/containers.hpp>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <string>
#include <unordered_map>
#include <unordered_set>
namespace mbgl {
@@ -147,13 +146,13 @@ public:
/// @return A `gfx::ShaderPtr`
virtual gfx::ShaderPtr getOrCreateShader(
gfx::Context&,
[[maybe_unused]] const std::unordered_set<StringIdentity>& propertiesAsUniforms,
[[maybe_unused]] const mbgl::unordered_set<StringIdentity>& propertiesAsUniforms,
[[maybe_unused]] std::string_view firstAttribName = "a_pos") {
return {};
}
private:
std::unordered_map<std::string, std::shared_ptr<gfx::Shader>> programs;
mbgl::unordered_map<std::string, std::shared_ptr<gfx::Shader>> programs;
mutable std::shared_mutex programLock;
};

View File

@@ -1,6 +1,7 @@
#pragma once
#include <mbgl/util/string_indexer.hpp>
#include <mbgl/util/containers.hpp>
#include <algorithm>
#include <functional>
@@ -62,7 +63,7 @@ protected:
/// Stores a collection of uniform blocks by name
class UniformBlockArray {
public:
using UniformBlockMap = std::unordered_map<StringIdentity, std::unique_ptr<UniformBlock>>;
using UniformBlockMap = mbgl::unordered_map<StringIdentity, std::unique_ptr<UniformBlock>>;
/// @brief Constructor
UniformBlockArray() = default;

View File

@@ -1,6 +1,7 @@
#pragma once
#include <mbgl/util/string_indexer.hpp>
#include <mbgl/util/containers.hpp>
#include <memory>
#include <string>
@@ -48,7 +49,7 @@ protected:
/// Stores a collection of uniform buffers by name
class UniformBufferArray {
public:
using UniformBufferMap = std::unordered_map<StringIdentity, std::shared_ptr<UniformBuffer>>;
using UniformBufferMap = mbgl::unordered_map<StringIdentity, std::shared_ptr<UniformBuffer>>;
UniformBufferArray() = default;
UniformBufferArray(UniformBufferArray&&);

View File

@@ -3,6 +3,7 @@
#include <mbgl/gfx/gfx_types.hpp>
#include <mbgl/renderer/paint_property_binder.hpp>
#include <mbgl/util/string_indexer.hpp>
#include <mbgl/util/containers.hpp>
#include <algorithm>
#include <array>
@@ -10,8 +11,6 @@
#include <functional>
#include <memory>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <variant>
#include <vector>
@@ -281,7 +280,7 @@ protected:
/// Stores a collection of vertex attributes by name
class VertexAttributeArray {
public:
using AttributeMap = std::unordered_map<StringIdentity, std::unique_ptr<VertexAttribute>>;
using AttributeMap = mbgl::unordered_map<StringIdentity, std::unique_ptr<VertexAttribute>>;
VertexAttributeArray() = default;
VertexAttributeArray(VertexAttributeArray&&);
@@ -394,7 +393,7 @@ public:
template <typename... DataDrivenPaintProperty, typename Binders, typename Evaluated>
void readDataDrivenPaintProperties(const Binders& binders,
const Evaluated& evaluated,
std::unordered_set<StringIdentity>& propertiesAsUniforms) {
mbgl::unordered_set<StringIdentity>& propertiesAsUniforms) {
// Read each property in the type pack
propertiesAsUniforms.reserve(sizeof...(DataDrivenPaintProperty));
(readDataDrivenPaintProperty<DataDrivenPaintProperty>(binders.template get<DataDrivenPaintProperty>(),
@@ -413,7 +412,7 @@ protected:
template <typename DataDrivenPaintProperty, typename Binder>
void readDataDrivenPaintProperty(const Binder& binder,
const bool isConstant,
std::unordered_set<StringIdentity>& propertiesAsUniforms) {
mbgl::unordered_set<StringIdentity>& propertiesAsUniforms) {
if (!binder) {
return;
}

View File

@@ -2,6 +2,7 @@
#include <mbgl/gfx/command_encoder.hpp>
#include <mbgl/mtl/mtl_fwd.hpp>
#include <mbgl/util/containers.hpp>
#include <functional>
#include <memory>
@@ -65,8 +66,8 @@ protected:
std::vector<GroupEntry> debugGroupNames;
std::vector<gfx::DebugGroup<gfx::RenderPass>> renderDebugGroups;
std::vector<gfx::DebugGroup<gfx::UploadPass>> uploadDebugGroups;
std::unordered_set<RenderPass*> renderPasses;
std::unordered_set<UploadPass*> uploadPasses;
mbgl::unordered_set<RenderPass*> renderPasses;
mbgl::unordered_set<UploadPass*> uploadPasses;
};
} // namespace mtl

View File

@@ -10,6 +10,7 @@
#include <mbgl/mtl/buffer_resource.hpp>
#include <mbgl/mtl/mtl_fwd.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/containers.hpp>
#include <memory>
#include <optional>
@@ -61,7 +62,7 @@ public:
std::string_view vertexName,
std::string_view fragmentName,
const ProgramParameters& programParameters,
const std::unordered_map<std::string, std::string>& additionalDefines);
const mbgl::unordered_map<std::string, std::string>& additionalDefines);
MTLTexturePtr createMetalTexture(MTLTextureDescriptorPtr textureDescriptor) const;
MTLSamplerStatePtr createMetalSamplerState(MTLSamplerDescriptorPtr samplerDescriptor) const;

View File

@@ -3,11 +3,11 @@
#include <mbgl/shaders/layer_ubo.hpp>
#include <mbgl/shaders/shader_source.hpp>
#include <mbgl/util/immutable.hpp>
#include <mbgl/util/containers.hpp>
#include <array>
#include <memory>
#include <string>
#include <unordered_set>
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<StringIdentity>&);
const std::unordered_set<StringIdentity>& getPropertiesAsUniforms() const;
void setPropertiesAsUniforms(const mbgl::unordered_set<StringIdentity>&);
const mbgl::unordered_set<StringIdentity>& 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<StringIdentity> propertiesAsUniforms;
mbgl::unordered_set<StringIdentity> propertiesAsUniforms;
#endif // MLN_RENDER_BACKEND_METAL
// Indicates that the evaluated properties have changed

View File

@@ -5,9 +5,9 @@
#include <mbgl/shaders/shader_source.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/util/hash.hpp>
#include <mbgl/util/containers.hpp>
#include <sstream>
#include <unordered_set>
namespace mbgl {
namespace gl {
@@ -21,7 +21,7 @@ public:
~ShaderGroupGL() noexcept override = default;
gfx::ShaderPtr getOrCreateShader(gfx::Context& context,
const std::unordered_set<StringIdentity>& propertiesAsUniforms,
const mbgl::unordered_set<StringIdentity>& propertiesAsUniforms,
std::string_view firstAttribName) override {
constexpr auto& vert = shaders::ShaderSource<ShaderID, gfx::Backend::Type::OpenGL>::vertex;
constexpr auto& frag = shaders::ShaderSource<ShaderID, gfx::Backend::Type::OpenGL>::fragment;

View File

@@ -5,6 +5,7 @@
#include <mbgl/shaders/mtl/background.hpp>
#include <mbgl/shaders/mtl/shader_program.hpp>
#include <mbgl/shaders/shader_source.hpp>
#include <mbgl/util/containers.hpp>
#include <numeric>
#include <string>
@@ -22,7 +23,7 @@ public:
~ShaderGroup() noexcept override = default;
gfx::ShaderPtr getOrCreateShader(gfx::Context& gfxContext,
const std::unordered_set<StringIdentity>& propertiesAsUniforms,
const mbgl::unordered_set<StringIdentity>& propertiesAsUniforms,
std::string_view /*firstAttribName*/) override {
constexpr auto& name = shaders::ShaderSource<ShaderID, gfx::Backend::Type::Metal>::name;
constexpr auto& source = shaders::ShaderSource<ShaderID, gfx::Backend::Type::Metal>::source;

View File

@@ -0,0 +1,23 @@
#pragma once
#if MLN_USE_UNORDERED_DENSE
#include <ankerl/unordered_dense.h>
#else
#include <unordered_map>
#include <unordered_set>
#endif
namespace mbgl {
#if MLN_USE_UNORDERED_DENSE
template <typename Key, typename Value>
using unordered_map = ankerl::unordered_dense::map<Key, Value>;
template <typename Value>
using unordered_set = ankerl::unordered_dense::set<Value>;
#else
template <typename Key, typename Value>
using unordered_map = std::unordered_map<Key, Value>;
template <typename Value>
using unordered_set = std::unordered_set<Value>;
#endif
} // namespace mbgl

View File

@@ -5,6 +5,7 @@
#include <mbgl/renderer/buckets/circle_bucket.hpp>
#include <mbgl/renderer/render_layer.hpp>
#include <mbgl/style/layers/circle_layer_impl.hpp>
#include <mbgl/util/containers.hpp>
namespace mbgl {
@@ -54,7 +55,7 @@ public:
void createBucket(const ImagePositions&,
std::unique_ptr<FeatureIndex>& featureIndex,
std::unordered_map<std::string, LayerRenderData>& renderData,
mbgl::unordered_map<std::string, LayerRenderData>& renderData,
const bool,
const bool,
const CanonicalTileID& canonical) override {

View File

@@ -3,6 +3,7 @@
#include <mbgl/renderer/image_atlas.hpp>
#include <mbgl/text/glyph_atlas.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/util/containers.hpp>
#include <memory>
namespace mbgl {
@@ -19,7 +20,7 @@ public:
virtual void createBucket(const ImagePositions&,
std::unique_ptr<FeatureIndex>&,
std::unordered_map<std::string, LayerRenderData>&,
mbgl::unordered_map<std::string, LayerRenderData>&,
bool,
bool,
const CanonicalTileID&) = 0;

View File

@@ -7,6 +7,7 @@
#include <mbgl/style/expression/image.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/style/layer_properties.hpp>
#include <mbgl/util/containers.hpp>
namespace mbgl {
@@ -171,7 +172,7 @@ public:
void createBucket(const ImagePositions& patternPositions,
std::unique_ptr<FeatureIndex>& featureIndex,
std::unordered_map<std::string, LayerRenderData>& renderData,
mbgl::unordered_map<std::string, LayerRenderData>& renderData,
const bool /*firstLoad*/,
const bool /*showCollisionBoxes*/,
const CanonicalTileID& canonical) override {

View File

@@ -14,6 +14,7 @@
#include <mbgl/util/string.hpp>
#include <mbgl/util/i18n.hpp>
#include <mbgl/util/platform.hpp>
#include <mbgl/util/containers.hpp>
#include <mapbox/polylabel.hpp>
@@ -783,7 +784,7 @@ std::vector<float> SymbolLayout::calculateTileDistances(const GeometryCoordinate
void SymbolLayout::createBucket(const ImagePositions&,
std::unique_ptr<FeatureIndex>&,
std::unordered_map<std::string, LayerRenderData>& renderData,
mbgl::unordered_map<std::string, LayerRenderData>& renderData,
const bool firstLoad,
const bool showCollisionBoxes,
const CanonicalTileID& canonical) {

View File

@@ -7,6 +7,7 @@
#include <mbgl/layout/symbol_instance.hpp>
#include <mbgl/text/bidi.hpp>
#include <mbgl/renderer/buckets/symbol_bucket.hpp>
#include <mbgl/util/containers.hpp>
#include <memory>
#include <map>
@@ -38,7 +39,7 @@ public:
void createBucket(const ImagePositions&,
std::unique_ptr<FeatureIndex>&,
std::unordered_map<std::string, LayerRenderData>&,
mbgl::unordered_map<std::string, LayerRenderData>&,
bool firstLoad,
bool showCollisionBoxes,
const CanonicalTileID& canonical) override;

View File

@@ -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<std::string, std::string>& additionalDefines) {
const mbgl::unordered_map<std::string, std::string>& additionalDefines) {
const auto pool = NS::TransferPtr(NS::AutoreleasePool::alloc()->init());
// No NSMutableDictionary?

View File

@@ -6,6 +6,7 @@
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/shaders/layer_ubo.hpp>
#include <mbgl/util/mat4.hpp>
#include <mbgl/util/containers.hpp>
#if MLN_RENDER_BACKEND_METAL
#include <mbgl/shaders/layer_ubo.hpp>
@@ -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<StringIdentity>& props) {
void LayerTweaker::setPropertiesAsUniforms([[maybe_unused]] const mbgl::unordered_set<StringIdentity>& 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<StringIdentity> emptyIDSet;
const mbgl::unordered_set<StringIdentity> emptyIDSet;
}
#endif
const std::unordered_set<StringIdentity>& LayerTweaker::getPropertiesAsUniforms() const {
const mbgl::unordered_set<StringIdentity>& LayerTweaker::getPropertiesAsUniforms() const {
#if MLN_RENDER_BACKEND_METAL
return propertiesAsUniforms;
#else

View File

@@ -13,6 +13,7 @@
#include <mbgl/tile/tile.hpp>
#include <mbgl/util/math.hpp>
#include <mbgl/util/intersection_tests.hpp>
#include <mbgl/util/containers.hpp>
#if MLN_DRAWABLE_RENDERER
#include <mbgl/gfx/drawable_builder.hpp>
@@ -325,7 +326,7 @@ void RenderCircleLayer::update(gfx::ShaderRegistry& shaders,
[&](gfx::Drawable& drawable) { return drawable.getTileID() && !hasRenderTile(*drawable.getTileID()); });
const auto& evaluated = static_cast<const CircleLayerProperties&>(*evaluatedProperties).evaluated;
std::unordered_set<StringIdentity> propertiesAsUniforms;
mbgl::unordered_set<StringIdentity> propertiesAsUniforms;
for (const RenderTile& tile : *renderTiles) {
const auto& tileID = tile.getOverscaledTileID();

View File

@@ -349,7 +349,7 @@ void RenderFillExtrusionLayer::update(gfx::ShaderRegistry& shaders,
tileLayerGroup->setStencilTiles(renderTiles);
std::unordered_set<StringIdentity> propertiesAsUniforms;
mbgl::unordered_set<StringIdentity> propertiesAsUniforms;
for (const RenderTile& tile : *renderTiles) {
const auto& tileID = tile.getOverscaledTileID();

View File

@@ -491,7 +491,7 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders,
fillTileLayerGroup->setStencilTiles(renderTiles);
std::unordered_set<StringIdentity> propertiesAsUniforms;
mbgl::unordered_set<StringIdentity> 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<StringIdentity> outlinePropertiesAsUniforms{
static const mbgl::unordered_set<StringIdentity> outlinePropertiesAsUniforms{
stringIndexer().get("a_color"),
stringIndexer().get("a_opacity"),
stringIndexer().get("a_width"),

View File

@@ -352,7 +352,7 @@ void RenderHeatmapLayer::update(gfx::ShaderRegistry& shaders,
[&](gfx::Drawable& drawable) { return drawable.getTileID() && !hasRenderTile(*drawable.getTileID()); });
const auto& evaluated = static_cast<const HeatmapLayerProperties&>(*evaluatedProperties).evaluated;
std::unordered_set<StringIdentity> propertiesAsUniforms;
mbgl::unordered_set<StringIdentity> propertiesAsUniforms;
for (const RenderTile& tile : *renderTiles) {
const auto& tileID = tile.getOverscaledTileID();

View File

@@ -463,7 +463,7 @@ void RenderLineLayer::update(gfx::ShaderRegistry& shaders,
tileLayerGroup->setStencilTiles(renderTiles);
std::unordered_set<StringIdentity> propertiesAsUniforms;
mbgl::unordered_set<StringIdentity> propertiesAsUniforms;
for (const RenderTile& tile : *renderTiles) {
const auto& tileID = tile.getOverscaledTileID();

View File

@@ -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<StringIdentity>& set) {
gfx::SymbolDrawableData::PropertyMapType toMap(const mbgl::unordered_set<StringIdentity>& set) {
// can we do this without allocating?
auto values = std::vector<bool>(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<StringIdentity>& propertiesAsUniforms) {
mbgl::unordered_set<StringIdentity>& 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<StringIdentity>& propertiesAsUniforms) {
mbgl::unordered_set<StringIdentity>& 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<StringIdentity> propertiesAsUniforms;
mbgl::unordered_set<StringIdentity> propertiesAsUniforms;
for (const RenderTile& tile : *renderTiles) {
const auto& tileID = tile.getOverscaledTileID();

View File

@@ -19,6 +19,7 @@
#include <mbgl/shaders/fill_layer_ubo.hpp>
#include <mbgl/util/math.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/util/containers.hpp>
#include <mbgl/gfx/fill_generator.hpp>
@@ -364,7 +365,7 @@ void CustomDrawableLayerHost::Interface::finish() {
gfx::ShaderPtr CustomDrawableLayerHost::Interface::lineShaderDefault() const {
gfx::ShaderGroupPtr lineShaderGroup = shaders.getShaderGroup("LineShader");
const std::unordered_set<StringIdentity> propertiesAsUniforms{
const mbgl::unordered_set<StringIdentity> 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<StringIdentity> propertiesAsUniforms{
const mbgl::unordered_set<StringIdentity> propertiesAsUniforms{
stringIndexer().get("a_color"),
stringIndexer().get("a_opacity"),
};

View File

@@ -8,6 +8,7 @@
#include <mbgl/tile/tile.hpp>
#include <mbgl/tile/geometry_tile_worker.hpp>
#include <mbgl/util/feature.hpp>
#include <mbgl/util/containers.hpp>
#include <atomic>
#include <memory>
@@ -65,14 +66,14 @@ public:
class LayoutResult {
public:
std::unordered_map<std::string, LayerRenderData> layerRenderData;
mbgl::unordered_map<std::string, LayerRenderData> layerRenderData;
std::shared_ptr<FeatureIndex> featureIndex;
std::optional<AlphaImage> glyphAtlasImage;
ImageAtlas iconAtlas;
LayerRenderData* getLayerRenderData(const style::Layer::Impl&);
LayoutResult(std::unordered_map<std::string, LayerRenderData> renderData_,
LayoutResult(mbgl::unordered_map<std::string, LayerRenderData> renderData_,
std::unique_ptr<FeatureIndex> featureIndex_,
std::optional<AlphaImage> glyphAtlasImage_,
ImageAtlas iconAtlas_)

View File

@@ -11,6 +11,7 @@
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/renderer/render_layer.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/util/containers.hpp>
#include <atomic>
#include <memory>
@@ -78,7 +79,7 @@ private:
const float pixelRatio;
std::unique_ptr<FeatureIndex> featureIndex;
std::unordered_map<std::string, LayerRenderData> renderData;
mbgl::unordered_map<std::string, LayerRenderData> renderData;
enum State {
Idle,

9
vendor/BUILD.bazel vendored
View File

@@ -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"],
)

1
vendor/unordered_dense vendored Submodule

Submodule vendor/unordered_dense added at 729896c7ba