diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml index bae2e0d82ac..50e30b3daaf 100644 --- a/.github/workflows/ios-ci.yml +++ b/.github/workflows/ios-ci.yml @@ -120,14 +120,14 @@ jobs: # size test - name: Build app for size test & output size - if: ${{ matrix.renderer }} == "legacy" + if: matrix.renderer == 'legacy' working-directory: ./ run: | bazel build --compilation_mode=opt //platform/ios:size --//:maplibre_platform=ios cp "$(bazel cquery --compilation_mode=opt --output=files //platform/ios:size --//:maplibre_platform=ios)" ./size - name: Upload size test result - if: ${{ matrix.renderer }} == "legacy" + if: matrix.renderer == 'legacy' uses: actions/upload-artifact@v3 with: if-no-files-found: error @@ -138,7 +138,7 @@ jobs: # render test - name: Build RenderTest .ipa and .xctest for AWS Device Farm - if: ${{ matrix.renderer }} == "legacy" + if: matrix.renderer == 'legacy' run: | set -e bazel run //platform/ios:xcodeproj @@ -155,7 +155,7 @@ jobs: echo render_test_artifacts_dir="$render_test_app_dir" >> "$GITHUB_ENV" - uses: actions/upload-artifact@v3 - if: ${{ matrix.renderer }} == "legacy" + if: matrix.renderer == 'legacy' with: name: ios-render-test retention-days: 3 @@ -167,7 +167,7 @@ jobs: # C++ unit tests - name: Build CppUnitTests .ipa and .xctest for AWS Device Farm - if: ${{ matrix.renderer }} == "legacy" + if: matrix.renderer == 'legacy' run: | set -e bazel run //platform/ios:xcodeproj @@ -184,7 +184,7 @@ jobs: echo ios_cpp_test_artifacts_dir="$ios_cpp_test_app_dir" >> "$GITHUB_ENV" - uses: actions/upload-artifact@v3 - if: ${{ matrix.renderer }} == "legacy" + if: matrix.renderer == 'legacy' with: name: ios-cpp-unit-tests retention-days: 3 diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 7e136b53170..a70cee1b4dc 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -39,11 +39,11 @@ jobs: ".bazelrc", ".bazelversion"] - linux-build: + linux-build-and-test: if: needs.pre_job.outputs.should_skip != 'true' needs: pre_job strategy: - fail-fast: false + fail-fast: true matrix: renderer: [legacy, drawable] runs-on: MapLibre_Native_Linux_16_core @@ -77,12 +77,13 @@ jobs: libjpeg-dev \ libpng-dev \ libglfw3-dev \ - libwebp-dev + libwebp-dev \ + libopengl0 - - if: ${{ matrix.renderer }} == "drawable" + - if: matrix.renderer == 'drawable' run: echo renderer_flag_cmake=-DMLN_DRAWABLE_RENDERER=ON >> "$GITHUB_ENV" - - if: ${{ matrix.renderer }} == "legacy" + - if: matrix.renderer == 'legacy' run: echo renderer_flag_cmake=-DMLN_LEGACY_RENDERER=ON >> "$GITHUB_ENV" - name: Build MapLibre Native Core @@ -98,95 +99,20 @@ jobs: with: category: "/language:cpp" - - name: Archive mbgl-test-runner - uses: actions/upload-artifact@v3 - with: - name: mbgl-test-runner - path: build/mbgl-test-runner - retention-days: 1 - - - name: Archive mbgl-render-test-runner - uses: actions/upload-artifact@v3 - with: - name: mbgl-render-test-runner - path: build/mbgl-render-test-runner - retention-days: 1 + # unit tests - - name: Archive mbgl-expression-test - uses: actions/upload-artifact@v3 - with: - name: mbgl-expression-test - path: build/expression-test/mbgl-expression-test - retention-days: 1 - - linux-test: - if: needs.pre_job.outputs.should_skip != 'true' - needs: - - pre_job - - linux-build - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y \ - libopengl0 - - - name: Download mbgl-test-runner - uses: actions/download-artifact@v3 - with: - name: mbgl-test-runner - - - run: chmod +x ./mbgl-test-runner + - run: chmod +x build/mbgl-test-runner - name: Run C++ tests - run: xvfb-run -a ./mbgl-test-runner + run: xvfb-run -a build/mbgl-test-runner - linux-expression-test: - if: needs.pre_job.outputs.should_skip != 'true' - needs: - - pre_job - - linux-build - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Download mbgl-expression-test - uses: actions/download-artifact@v3 - with: - name: mbgl-expression-test - - - run: chmod +x ./mbgl-expression-test - - - name: Run expression test - run: ./mbgl-expression-test - - linux-render-test: - if: needs.pre_job.outputs.should_skip != 'true' - needs: - - pre_job - - linux-build - runs-on: ubuntu-22.04 - steps: - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y \ - libopengl0 + # render tests - - uses: actions/checkout@v4 - - - name: Download mbgl-render-test-runner - uses: actions/download-artifact@v3 - with: - name: mbgl-render-test-runner - - - run: chmod +x ./mbgl-render-test-runner + - run: chmod +x build/mbgl-render-test-runner - name: Run render test id: render_test - run: xvfb-run -a ./mbgl-render-test-runner --manifestPath=metrics/linux-gcc8-release-style.json + run: xvfb-run -a build/mbgl-render-test-runner --manifestPath=metrics/linux-${{ matrix.renderer }}.json - name: Upload render test result if: always() && steps.render_test.outcome == 'failure' @@ -195,6 +121,13 @@ jobs: name: render-test-result path: | metrics/linux-gcc8-release-style.html + + # expression tests + + - run: chmod +x build/expression-test/mbgl-expression-test + + - name: Run expression test + run: build/expression-test/mbgl-expression-test linux-coverage: runs-on: ubuntu-22.04 @@ -254,11 +187,9 @@ jobs: runs-on: ubuntu-22.04 needs: - pre_job - - linux-build - - linux-test - - linux-render-test + - linux-build-and-test - linux-coverage steps: - name: Mark result as failed - if: needs.linux-build.result != 'success' || needs.linux-test.result != 'success' || needs.linux-render-test.result != 'success' || needs.linux-coverage.result != 'success' + if: needs.linux-build-and-test.result != 'success' || needs.linux-coverage.result != 'success' run: exit 1 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0f75dfdbe67..0f7182fe982 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: hooks: - id: buildifier - repo: https://github.com/Mateusz-Grzelinski/actionlint-py - rev: v1.6.25.9 + rev: v1.6.26.11 hooks: - id: actionlint additional_dependencies: [shellcheck-py] diff --git a/CMakeLists.txt b/CMakeLists.txt index d67f539df00..351968be702 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,10 @@ add_library( set(UBSAN_BLACKLIST ${PROJECT_SOURCE_DIR}/scripts/ubsan.blacklist) +if (MLN_DRAWABLE_RENDERER) + set(MLN_LEGACY_RENDERER OFF) +endif() + target_compile_options( mbgl-compiler-options INTERFACE diff --git a/include/mbgl/gfx/vertex_attribute.hpp b/include/mbgl/gfx/vertex_attribute.hpp index 4ce7dc0d944..db3b1401f0c 100644 --- a/include/mbgl/gfx/vertex_attribute.hpp +++ b/include/mbgl/gfx/vertex_attribute.hpp @@ -239,8 +239,9 @@ class VertexAttribute { const gfx::UniqueVertexBufferResource& getBuffer() const { return buffer; } void setBuffer(gfx::UniqueVertexBufferResource&& value) { buffer = std::move(value); } -protected: VertexAttribute& operator=(const VertexAttribute&) = delete; + +protected: VertexAttribute& operator=(VertexAttribute&& other) { index = other.index; dataType = other.dataType; @@ -386,7 +387,7 @@ class VertexAttributeArray { auto& attributeNameID = DataDrivenPaintProperty::AttributeNameIDs[attrIndex]; if (!attributeNameID) { - attributeNameID = StringIndexer::get(attributePrefix + attributeName.data()); + attributeNameID = stringIndexer().get(attributePrefix + attributeName.data()); } const auto vertexCount = binder->getVertexCount(); diff --git a/include/mbgl/shaders/gl/shader_group_gl.hpp b/include/mbgl/shaders/gl/shader_group_gl.hpp index 9c54ed5ea8b..4325b5a419e 100644 --- a/include/mbgl/shaders/gl/shader_group_gl.hpp +++ b/include/mbgl/shaders/gl/shader_group_gl.hpp @@ -42,7 +42,7 @@ class ShaderGroupGL final : public gfx::ShaderGroup { additionalDefines.reserve(propertiesAsUniforms.size() * 48); for (const auto nameID : propertiesAsUniforms) { // We expect the names to be prefixed by "a_", but we need just the base here. - const auto prefixedAttrName = StringIndexer::get(nameID); + const auto prefixedAttrName = stringIndexer().get(nameID); const auto* prefix = prefixedAttrName.data(); if (prefix[0] == 'a' && prefix[1] == '_') { prefix += 2; diff --git a/include/mbgl/util/string_indexer.hpp b/include/mbgl/util/string_indexer.hpp index cf4f5b6c725..7a0582369f6 100644 --- a/include/mbgl/util/string_indexer.hpp +++ b/include/mbgl/util/string_indexer.hpp @@ -15,36 +15,28 @@ using StringIdentity = std::size_t; class StringIndexer { public: + StringIndexer(); + StringIndexer(StringIndexer const&) = delete; StringIndexer(StringIndexer&&) = delete; void operator=(StringIndexer const&) = delete; + ~StringIndexer() = default; - static StringIdentity get(std::string_view); - - static std::string get(const StringIdentity id); + StringIdentity get(std::string_view); - static void clear(); + std::string get(const StringIdentity id); - static size_t size(); + size_t size(); protected: - StringIndexer(); - ~StringIndexer() = default; - - using MapType = std::unordered_map; - using VectorType = std::vector; - using BufferType = std::vector; - - static StringIndexer& instance() { - static StringIndexer inst; - return inst; - } - - MapType stringToIdentity; - VectorType identityToString; - BufferType buffer; + std::unordered_map stringToIdentity; + std::vector identityToString; + std::vector buffer; std::shared_mutex sharedMutex; }; +/// StringIndexer singleton +StringIndexer& stringIndexer(); + } // namespace mbgl diff --git a/metrics/ignores/linux-drawable.json b/metrics/ignores/linux-drawable.json new file mode 100644 index 00000000000..0634f7d272a --- /dev/null +++ b/metrics/ignores/linux-drawable.json @@ -0,0 +1,3 @@ +{ + "render-tests/regressions/mapbox-gl-js#3426": "https://github.com/maplibre/maplibre-native/issues/1734" +} \ No newline at end of file diff --git a/metrics/linux-drawable.json b/metrics/linux-drawable.json new file mode 100644 index 00000000000..9359406ddbd --- /dev/null +++ b/metrics/linux-drawable.json @@ -0,0 +1,16 @@ +{ + "base_test_path": "integration", + "cache_path": "cache-style.db", + "expectation_paths": [ + "expectations/platform-all" + ], + "ignore_paths": [ + "ignores/platform-all.json", + "ignores/platform-linux.json", + "ignores/linux-drawable.json" + ], + "metric_path": "linux-gcc8-release", + "probes": [ + "probeNetwork" + ] +} diff --git a/metrics/linux-legacy.json b/metrics/linux-legacy.json new file mode 100644 index 00000000000..e50a58969c1 --- /dev/null +++ b/metrics/linux-legacy.json @@ -0,0 +1,16 @@ +{ + "base_test_path": "integration", + "cache_path": "cache-style.db", + "expectation_paths": [ + "expectations/platform-all" + ], + "ignore_paths": [ + "ignores/platform-all.json", + "ignores/platform-linux.json" + ], + "metric_path": "linux-gcc8-release", + "probes": [ + "probeGFX", + "probeNetwork" + ] +} diff --git a/platform/ios/test/BUILD.bazel b/platform/ios/test/BUILD.bazel index a29bf746108..2809711f5c7 100644 --- a/platform/ios/test/BUILD.bazel +++ b/platform/ios/test/BUILD.bazel @@ -1,9 +1,9 @@ -load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") load( "@build_bazel_rules_swift//swift:swift.bzl", "swift_library", ) +load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS") objc_library( name = "ios_tests_objc_srcs", @@ -54,6 +54,7 @@ swift_library( ios_unit_test( name = "ios_test", + timeout = "long", minimum_os_version = "12.0", runner = "@build_bazel_rules_apple//apple/testing/default_runner:ios_xctestrun_ordered_runner", visibility = [ @@ -63,11 +64,11 @@ ios_unit_test( "ios_tests_objc_srcs", "ios_tests_objcpp_srcs", "ios_tests_swift_srcs", + "//platform/darwin:darwin_objc_hdrs", + "//platform/darwin:darwin_objcpp_hdrs", "//platform/darwin:shared_tests_objc_srcs", "//platform/darwin:shared_tests_objcpp_srcs", "//platform/darwin:shared_tests_swift_srcs", - "//platform/darwin:darwin_objc_hdrs", - "//platform/darwin:darwin_objcpp_hdrs", ], ) diff --git a/src/mbgl/gfx/drawable_builder.cpp b/src/mbgl/gfx/drawable_builder.cpp index 22d34acb5c1..08a1c7c788d 100644 --- a/src/mbgl/gfx/drawable_builder.cpp +++ b/src/mbgl/gfx/drawable_builder.cpp @@ -12,7 +12,7 @@ namespace gfx { DrawableBuilder::DrawableBuilder(std::string name_) : name(std::move(name_)), - vertexAttrNameId(StringIndexer::get("a_pos")), + vertexAttrNameId(stringIndexer().get("a_pos")), renderPass(mbgl::RenderPass::Opaque), impl(std::make_unique()) {} diff --git a/src/mbgl/gfx/drawable_custom_layer_host_tweaker.cpp b/src/mbgl/gfx/drawable_custom_layer_host_tweaker.cpp index 8700642ce4a..6a19ac676f0 100644 --- a/src/mbgl/gfx/drawable_custom_layer_host_tweaker.cpp +++ b/src/mbgl/gfx/drawable_custom_layer_host_tweaker.cpp @@ -6,8 +6,6 @@ #include #include -#include - namespace mbgl { namespace gfx { diff --git a/src/mbgl/gl/drawable_gl.cpp b/src/mbgl/gl/drawable_gl.cpp index fdc9e3f3945..97cd8829721 100644 --- a/src/mbgl/gl/drawable_gl.cpp +++ b/src/mbgl/gl/drawable_gl.cpp @@ -124,7 +124,7 @@ void DrawableGL::bindUniformBuffers() const { using namespace std::string_literals; const auto tileIDStr = getTileID() ? util::toString(*getTileID()) : ""; Log::Error(Event::General, - "bindUniformBuffers: UBO "s + std::string(StringIndexer::get(element.first)) + + "bindUniformBuffers: UBO "s + std::string(stringIndexer().get(element.first)) + " not found for " + util::toString(getID()) + " / " + getName() + " / " + tileIDStr + ". skipping."); assert(false); diff --git a/src/mbgl/gl/drawable_gl_impl.hpp b/src/mbgl/gl/drawable_gl_impl.hpp index 7cab156fc42..5d4c4e21d59 100644 --- a/src/mbgl/gl/drawable_gl_impl.hpp +++ b/src/mbgl/gl/drawable_gl_impl.hpp @@ -51,7 +51,7 @@ class DrawableGL::Impl final { gfx::CullFaceMode cullFaceMode; GLfloat pointSize = 0.0f; - StringIdentity idVertexAttrName = StringIndexer::get("a_pos"); + StringIdentity idVertexAttrName = stringIndexer().get("a_pos"); }; struct DrawableGL::DrawSegmentGL final : public gfx::Drawable::DrawSegment { diff --git a/src/mbgl/gl/offscreen_texture.cpp b/src/mbgl/gl/offscreen_texture.cpp index 40e81631739..88f719ce49b 100644 --- a/src/mbgl/gl/offscreen_texture.cpp +++ b/src/mbgl/gl/offscreen_texture.cpp @@ -18,7 +18,7 @@ class OffscreenTextureResource final : public gl::RenderableResource { texture->setSize(size); texture->setFormat(gfx::TexturePixelType::RGBA, type); texture->setSamplerConfiguration( - {gfx::TextureFilterType::Nearest, gfx::TextureWrapType::Clamp, gfx::TextureWrapType::Clamp}); + {gfx::TextureFilterType::Linear, gfx::TextureWrapType::Clamp, gfx::TextureWrapType::Clamp}); #endif } diff --git a/src/mbgl/gl/upload_pass.cpp b/src/mbgl/gl/upload_pass.cpp index ce08a36b206..2d1c1ba9066 100644 --- a/src/mbgl/gl/upload_pass.cpp +++ b/src/mbgl/gl/upload_pass.cpp @@ -260,7 +260,7 @@ gfx::AttributeBindingArray UploadPass::buildAttributeBindings( // something else, the binding is invalid // TODO: throw? Log::Warning(Event::General, - "Got " + util::toString(rawData.size()) + " bytes for attribute '" + StringIndexer::get(id) + + "Got " + util::toString(rawData.size()) + " bytes for attribute '" + stringIndexer().get(id) + "' (" + util::toString(defaultGL.getIndex()) + "), expected " + util::toString(stride) + " or " + util::toString(stride * vertexCount)); return; diff --git a/src/mbgl/mtl/drawable.cpp b/src/mbgl/mtl/drawable.cpp index 752dd8b8820..30e293ad70d 100644 --- a/src/mbgl/mtl/drawable.cpp +++ b/src/mbgl/mtl/drawable.cpp @@ -331,7 +331,7 @@ void Drawable::setVertices(std::vector&& data, std::size_t count, gfx:: using namespace std::string_literals; Log::Warning( Event::General, - "Vertex attribute type mismatch: "s + name + " / " + StringIndexer::get(impl->idVertexAttrName)); + "Vertex attribute type mismatch: "s + name + " / " + stringIndexer().get(impl->idVertexAttrName)); assert(false); } } @@ -400,7 +400,7 @@ void Drawable::bindUniformBuffers(const RenderPass& renderPass) const { const auto tileID = getTileID() ? util::toString(*getTileID()) : ""; const auto tileLabel = util::toString(getID()) + "/" + getName() + "/" + tileID; Log::Error(Event::General, - "bindUniformBuffers: UBO "s + StringIndexer::get(element.first) + " not found on " + + "bindUniformBuffers: UBO "s + stringIndexer().get(element.first) + " not found on " + tileLabel + ". skipping."); assert(false); continue; diff --git a/src/mbgl/mtl/drawable_impl.hpp b/src/mbgl/mtl/drawable_impl.hpp index a0face52207..e1bebaf96d2 100644 --- a/src/mbgl/mtl/drawable_impl.hpp +++ b/src/mbgl/mtl/drawable_impl.hpp @@ -53,7 +53,7 @@ class Drawable::Impl final { gfx::StencilMode stencilMode; gfx::CullFaceMode cullFaceMode; // GLfloat pointSize = 0.0f; - StringIdentity idVertexAttrName = StringIndexer::get("a_pos"); + StringIdentity idVertexAttrName = stringIndexer().get("a_pos"); gfx::UniqueVertexBufferResource noBindingBuffer; diff --git a/src/mbgl/renderer/layers/background_layer_tweaker.cpp b/src/mbgl/renderer/layers/background_layer_tweaker.cpp index d4ee0b03308..5b063d8e71c 100644 --- a/src/mbgl/renderer/layers/background_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/background_layer_tweaker.cpp @@ -19,9 +19,9 @@ using namespace shaders; #if !defined(NDEBUG) constexpr auto BackgroundPatternShaderName = "BackgroundPatternShader"; #endif -static const StringIdentity idBackgroundDrawableUBOName = StringIndexer::get("BackgroundDrawableUBO"); -static const StringIdentity idBackgroundLayerUBOName = StringIndexer::get("BackgroundLayerUBO"); -static const StringIdentity idTexUniformName = StringIndexer::get("u_image"); +static const StringIdentity idBackgroundDrawableUBOName = stringIndexer().get("BackgroundDrawableUBO"); +static const StringIdentity idBackgroundLayerUBOName = stringIndexer().get("BackgroundLayerUBO"); +static const StringIdentity idTexUniformName = stringIndexer().get("u_image"); void BackgroundLayerTweaker::execute(LayerGroupBase& layerGroup, const RenderTree&, const PaintParameters& parameters) { const auto& state = parameters.state; diff --git a/src/mbgl/renderer/layers/circle_layer_tweaker.cpp b/src/mbgl/renderer/layers/circle_layer_tweaker.cpp index cfd1889c781..ad37fb0520c 100644 --- a/src/mbgl/renderer/layers/circle_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/circle_layer_tweaker.cpp @@ -22,12 +22,12 @@ namespace mbgl { using namespace style; using namespace shaders; -static const StringIdentity idCircleDrawableUBOName = StringIndexer::get("CircleDrawableUBO"); -static const StringIdentity idCirclePaintParamsUBOName = StringIndexer::get("CirclePaintParamsUBO"); -static const StringIdentity idCircleEvaluatedPropsUBOName = StringIndexer::get("CircleEvaluatedPropsUBO"); +static const StringIdentity idCircleDrawableUBOName = stringIndexer().get("CircleDrawableUBO"); +static const StringIdentity idCirclePaintParamsUBOName = stringIndexer().get("CirclePaintParamsUBO"); +static const StringIdentity idCircleEvaluatedPropsUBOName = stringIndexer().get("CircleEvaluatedPropsUBO"); -static const StringIdentity idExpressionInputsUBOName = StringIndexer::get("ExpressionInputsUBO"); -static const StringIdentity idCirclePermutationUBOName = StringIndexer::get("CirclePermutationUBO"); +static const StringIdentity idExpressionInputsUBOName = stringIndexer().get("ExpressionInputsUBO"); +static const StringIdentity idCirclePermutationUBOName = stringIndexer().get("CirclePermutationUBO"); void CircleLayerTweaker::execute(LayerGroupBase& layerGroup, const RenderTree& renderTree, diff --git a/src/mbgl/renderer/layers/collision_layer_tweaker.cpp b/src/mbgl/renderer/layers/collision_layer_tweaker.cpp index d46a60aaeb8..160a46df83c 100644 --- a/src/mbgl/renderer/layers/collision_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/collision_layer_tweaker.cpp @@ -21,8 +21,8 @@ namespace mbgl { using namespace style; using namespace shaders; -const StringIdentity CollisionLayerTweaker::idCollisionCircleUBOName = StringIndexer::get(CollisionCircleUBOName); -const StringIdentity CollisionLayerTweaker::idCollisionBoxUBOName = StringIndexer::get(CollisionBoxUBOName); +const StringIdentity CollisionLayerTweaker::idCollisionCircleUBOName = stringIndexer().get(CollisionCircleUBOName); +const StringIdentity CollisionLayerTweaker::idCollisionBoxUBOName = stringIndexer().get(CollisionBoxUBOName); void CollisionLayerTweaker::execute(LayerGroupBase& layerGroup, const RenderTree& renderTree, diff --git a/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp b/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp index 660572e03e4..f6056a4e33b 100644 --- a/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp @@ -26,17 +26,17 @@ using namespace shaders; using namespace style; namespace { -const StringIdentity idFillExtrusionDrawableUBOName = StringIndexer::get("FillExtrusionDrawableUBO"); -const StringIdentity idFillExtrusionDrawablePropsUBOName = StringIndexer::get("FillExtrusionDrawablePropsUBO"); -const StringIdentity idExpressionInputsUBOName = StringIndexer::get("ExpressionInputsUBO"); -const StringIdentity idFillExtrusionPermutationUBOName = StringIndexer::get("FillExtrusionPermutationUBO"); -const StringIdentity idTexImageName = StringIndexer::get("u_image"); +const StringIdentity idFillExtrusionDrawableUBOName = stringIndexer().get("FillExtrusionDrawableUBO"); +const StringIdentity idFillExtrusionDrawablePropsUBOName = stringIndexer().get("FillExtrusionDrawablePropsUBO"); +const StringIdentity idExpressionInputsUBOName = stringIndexer().get("ExpressionInputsUBO"); +const StringIdentity idFillExtrusionPermutationUBOName = stringIndexer().get("FillExtrusionPermutationUBO"); +const StringIdentity idTexImageName = stringIndexer().get("u_image"); } // namespace -const StringIdentity FillExtrusionLayerTweaker::idFillExtrusionTilePropsUBOName = StringIndexer::get( +const StringIdentity FillExtrusionLayerTweaker::idFillExtrusionTilePropsUBOName = stringIndexer().get( "FillExtrusionDrawableTilePropsUBO"); -const StringIdentity FillExtrusionLayerTweaker::idFillExtrusionInterpolateUBOName = StringIndexer::get( +const StringIdentity FillExtrusionLayerTweaker::idFillExtrusionInterpolateUBOName = stringIndexer().get( "FillExtrusionInterpolateUBO"); void FillExtrusionLayerTweaker::execute(LayerGroupBase& layerGroup, diff --git a/src/mbgl/renderer/layers/fill_layer_tweaker.cpp b/src/mbgl/renderer/layers/fill_layer_tweaker.cpp index fa2907533ed..e5b0fac8d5d 100644 --- a/src/mbgl/renderer/layers/fill_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/fill_layer_tweaker.cpp @@ -24,40 +24,41 @@ namespace mbgl { using namespace style; -static const StringIdentity idFillDrawableUBOName = StringIndexer::get("FillDrawableUBO"); -static const StringIdentity idFillDrawablePropsUBOName = StringIndexer::get("FillDrawablePropsUBO"); -static const StringIdentity idFillEvaluatedPropsUBOName = StringIndexer::get("FillEvaluatedPropsUBO"); -static const StringIdentity idFillPermutationUBOName = StringIndexer::get("FillPermutationUBO"); - -const StringIdentity FillLayerTweaker::idFillTilePropsUBOName = StringIndexer::get("FillDrawableTilePropsUBO"); -const StringIdentity FillLayerTweaker::idFillInterpolateUBOName = StringIndexer::get("FillInterpolateUBO"); -const StringIdentity FillLayerTweaker::idFillOutlineInterpolateUBOName = StringIndexer::get( +static const StringIdentity idFillDrawableUBOName = stringIndexer().get("FillDrawableUBO"); +static const StringIdentity idFillDrawablePropsUBOName = stringIndexer().get("FillDrawablePropsUBO"); +static const StringIdentity idFillEvaluatedPropsUBOName = stringIndexer().get("FillEvaluatedPropsUBO"); +static const StringIdentity idFillPermutationUBOName = stringIndexer().get("FillPermutationUBO"); + +const StringIdentity FillLayerTweaker::idFillTilePropsUBOName = stringIndexer().get("FillDrawableTilePropsUBO"); +const StringIdentity FillLayerTweaker::idFillInterpolateUBOName = stringIndexer().get("FillInterpolateUBO"); +const StringIdentity FillLayerTweaker::idFillOutlineInterpolateUBOName = stringIndexer().get( "FillOutlineInterpolateUBO"); -static const StringIdentity idFillOutlineDrawableUBOName = StringIndexer::get("FillOutlineDrawableUBO"); -static const StringIdentity idFillOutlineEvaluatedPropsUBOName = StringIndexer::get("FillOutlineEvaluatedPropsUBO"); -static const StringIdentity idFillOutlinePermutationUBOName = StringIndexer::get("FillOutlinePermutationUBO"); +static const StringIdentity idFillOutlineDrawableUBOName = stringIndexer().get("FillOutlineDrawableUBO"); +static const StringIdentity idFillOutlineEvaluatedPropsUBOName = stringIndexer().get("FillOutlineEvaluatedPropsUBO"); +static const StringIdentity idFillOutlinePermutationUBOName = stringIndexer().get("FillOutlinePermutationUBO"); -static const StringIdentity idFillOutlineInterpolateUBOName = StringIndexer::get("FillOutlineInterpolateUBO"); +static const StringIdentity idFillOutlineInterpolateUBOName = stringIndexer().get("FillOutlineInterpolateUBO"); -static const StringIdentity idFillPatternDrawableUBOName = StringIndexer::get("FillPatternDrawableUBO"); -static const StringIdentity idFillPatternPermutationUBOName = StringIndexer::get("FillPatternPermutationUBO"); -static const StringIdentity idFillPatternInterpolateUBOName = StringIndexer::get("FillPatternInterpolateUBO"); -static const StringIdentity idFillPatternEvaluatedPropsUBOName = StringIndexer::get("FillPatternEvaluatedPropsUBO"); -static const StringIdentity idFillPatternTilePropsUBOName = StringIndexer::get("FillPatternTilePropsUBO"); +static const StringIdentity idFillPatternDrawableUBOName = stringIndexer().get("FillPatternDrawableUBO"); +static const StringIdentity idFillPatternPermutationUBOName = stringIndexer().get("FillPatternPermutationUBO"); +static const StringIdentity idFillPatternInterpolateUBOName = stringIndexer().get("FillPatternInterpolateUBO"); +static const StringIdentity idFillPatternEvaluatedPropsUBOName = stringIndexer().get("FillPatternEvaluatedPropsUBO"); +static const StringIdentity idFillPatternTilePropsUBOName = stringIndexer().get("FillPatternTilePropsUBO"); -static const StringIdentity idFillOutlinePatternDrawableUBOName = StringIndexer::get("FillOutlinePatternDrawableUBO"); -static const StringIdentity idFillOutlinePatternPermutationUBOName = StringIndexer::get( +static const StringIdentity idFillOutlinePatternDrawableUBOName = stringIndexer().get("FillOutlinePatternDrawableUBO"); +static const StringIdentity idFillOutlinePatternPermutationUBOName = stringIndexer().get( "FillOutlinePatternPermutationUBO"); -static const StringIdentity idFillOutlinePatternInterpolateUBOName = StringIndexer::get( +static const StringIdentity idFillOutlinePatternInterpolateUBOName = stringIndexer().get( "FillOutlinePatternInterpolateUBO"); -static const StringIdentity idFillOutlinePatternEvaluatedPropsUBOName = StringIndexer::get( +static const StringIdentity idFillOutlinePatternEvaluatedPropsUBOName = stringIndexer().get( "FillOutlinePatternEvaluatedPropsUBO"); -static const StringIdentity idFillOutlinePatternTilePropsUBOName = StringIndexer::get("FillOutlinePatternTilePropsUBO"); +static const StringIdentity idFillOutlinePatternTilePropsUBOName = stringIndexer().get( + "FillOutlinePatternTilePropsUBO"); -static const StringIdentity idExpressionInputsUBOName = StringIndexer::get("ExpressionInputsUBO"); +static const StringIdentity idExpressionInputsUBOName = stringIndexer().get("ExpressionInputsUBO"); -static const StringIdentity idTexImageName = StringIndexer::get("u_image"); +static const StringIdentity idTexImageName = stringIndexer().get("u_image"); using namespace shaders; void FillLayerTweaker::execute(LayerGroupBase& layerGroup, diff --git a/src/mbgl/renderer/layers/heatmap_layer_tweaker.cpp b/src/mbgl/renderer/layers/heatmap_layer_tweaker.cpp index 16a76661ed1..2867468f42f 100644 --- a/src/mbgl/renderer/layers/heatmap_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/heatmap_layer_tweaker.cpp @@ -20,10 +20,10 @@ namespace mbgl { using namespace style; using namespace shaders; -static const StringIdentity idHeatmapDrawableUBOName = StringIndexer::get("HeatmapDrawableUBO"); -static const StringIdentity idHeatmapEvaluatedPropsUBOName = StringIndexer::get("HeatmapEvaluatedPropsUBO"); -static const StringIdentity idHeatmapPermutationUBOName = StringIndexer::get("HeatmapPermutationUBO"); -static const StringIdentity idExpressionInputsUBOName = StringIndexer::get("ExpressionInputsUBO"); +static const StringIdentity idHeatmapDrawableUBOName = stringIndexer().get("HeatmapDrawableUBO"); +static const StringIdentity idHeatmapEvaluatedPropsUBOName = stringIndexer().get("HeatmapEvaluatedPropsUBO"); +static const StringIdentity idHeatmapPermutationUBOName = stringIndexer().get("HeatmapPermutationUBO"); +static const StringIdentity idExpressionInputsUBOName = stringIndexer().get("ExpressionInputsUBO"); void HeatmapLayerTweaker::execute(LayerGroupBase& layerGroup, const RenderTree& renderTree, diff --git a/src/mbgl/renderer/layers/heatmap_texture_layer_tweaker.cpp b/src/mbgl/renderer/layers/heatmap_texture_layer_tweaker.cpp index d7542bbbd31..8efc1645dce 100644 --- a/src/mbgl/renderer/layers/heatmap_texture_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/heatmap_texture_layer_tweaker.cpp @@ -16,7 +16,7 @@ namespace mbgl { using namespace style; using namespace shaders; -static const StringIdentity idHeatmapTextureDrawableUBOName = StringIndexer::get("HeatmapTextureDrawableUBO"); +static const StringIdentity idHeatmapTextureDrawableUBOName = stringIndexer().get("HeatmapTextureDrawableUBO"); void HeatmapTextureLayerTweaker::execute(LayerGroupBase& layerGroup, [[maybe_unused]] const RenderTree& renderTree, diff --git a/src/mbgl/renderer/layers/hillshade_layer_tweaker.cpp b/src/mbgl/renderer/layers/hillshade_layer_tweaker.cpp index 7e030ba3687..786858516ed 100644 --- a/src/mbgl/renderer/layers/hillshade_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/hillshade_layer_tweaker.cpp @@ -15,8 +15,8 @@ namespace mbgl { using namespace style; using namespace shaders; -static const StringIdentity idHillshadeDrawableUBOName = StringIndexer::get("HillshadeDrawableUBO"); -static const StringIdentity idHillshadeEvaluatedPropsUBOName = StringIndexer::get("HillshadeEvaluatedPropsUBO"); +static const StringIdentity idHillshadeDrawableUBOName = stringIndexer().get("HillshadeDrawableUBO"); +static const StringIdentity idHillshadeEvaluatedPropsUBOName = stringIndexer().get("HillshadeEvaluatedPropsUBO"); std::array getLatRange(const UnwrappedTileID& id) { const LatLng latlng0 = LatLng(id); diff --git a/src/mbgl/renderer/layers/hillshade_prepare_layer_tweaker.cpp b/src/mbgl/renderer/layers/hillshade_prepare_layer_tweaker.cpp index d8971b00add..d445c192bf9 100644 --- a/src/mbgl/renderer/layers/hillshade_prepare_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/hillshade_prepare_layer_tweaker.cpp @@ -16,7 +16,7 @@ namespace mbgl { using namespace style; using namespace shaders; -static const StringIdentity idHillshadePrepareDrawableUBOName = StringIndexer::get("HillshadePrepareDrawableUBO"); +static const StringIdentity idHillshadePrepareDrawableUBOName = stringIndexer().get("HillshadePrepareDrawableUBO"); const std::array& getUnpackVector(Tileset::DEMEncoding encoding) { // https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb diff --git a/src/mbgl/renderer/layers/line_layer_tweaker.cpp b/src/mbgl/renderer/layers/line_layer_tweaker.cpp index c2373f20d3c..b1bf897f497 100644 --- a/src/mbgl/renderer/layers/line_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/line_layer_tweaker.cpp @@ -24,18 +24,18 @@ namespace mbgl { using namespace style; using namespace shaders; -static const StringIdentity idLineUBOName = StringIndexer::get("LineUBO"); -static const StringIdentity idLinePropertiesUBOName = StringIndexer::get("LinePropertiesUBO"); -static const StringIdentity idLineGradientUBOName = StringIndexer::get("LineGradientUBO"); -static const StringIdentity idLineGradientPropertiesUBOName = StringIndexer::get("LineGradientPropertiesUBO"); -static const StringIdentity idLinePatternUBOName = StringIndexer::get("LinePatternUBO"); -static const StringIdentity idLinePatternPropertiesUBOName = StringIndexer::get("LinePatternPropertiesUBO"); -static const StringIdentity idLineSDFUBOName = StringIndexer::get("LineSDFUBO"); -static const StringIdentity idLineSDFPropertiesUBOName = StringIndexer::get("LineSDFPropertiesUBO"); -static const StringIdentity idTexImageName = StringIndexer::get("u_image"); +static const StringIdentity idLineUBOName = stringIndexer().get("LineUBO"); +static const StringIdentity idLinePropertiesUBOName = stringIndexer().get("LinePropertiesUBO"); +static const StringIdentity idLineGradientUBOName = stringIndexer().get("LineGradientUBO"); +static const StringIdentity idLineGradientPropertiesUBOName = stringIndexer().get("LineGradientPropertiesUBO"); +static const StringIdentity idLinePatternUBOName = stringIndexer().get("LinePatternUBO"); +static const StringIdentity idLinePatternPropertiesUBOName = stringIndexer().get("LinePatternPropertiesUBO"); +static const StringIdentity idLineSDFUBOName = stringIndexer().get("LineSDFUBO"); +static const StringIdentity idLineSDFPropertiesUBOName = stringIndexer().get("LineSDFPropertiesUBO"); +static const StringIdentity idTexImageName = stringIndexer().get("u_image"); -static const StringIdentity idExpressionInputsUBOName = StringIndexer::get("ExpressionInputsUBO"); -static const StringIdentity idLinePermutationUBOName = StringIndexer::get("LinePermutationUBO"); +static const StringIdentity idExpressionInputsUBOName = stringIndexer().get("ExpressionInputsUBO"); +static const StringIdentity idLinePermutationUBOName = stringIndexer().get("LinePermutationUBO"); void LineLayerTweaker::execute(LayerGroupBase& layerGroup, const RenderTree& renderTree, diff --git a/src/mbgl/renderer/layers/raster_layer_tweaker.cpp b/src/mbgl/renderer/layers/raster_layer_tweaker.cpp index 2854f82dd21..6d4a38ed8e7 100644 --- a/src/mbgl/renderer/layers/raster_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/raster_layer_tweaker.cpp @@ -17,7 +17,7 @@ namespace mbgl { using namespace style; using namespace shaders; -static const StringIdentity idRasterDrawableUBOName = StringIndexer::get("RasterDrawableUBO"); +static const StringIdentity idRasterDrawableUBOName = stringIndexer().get("RasterDrawableUBO"); void RasterLayerTweaker::execute([[maybe_unused]] LayerGroupBase& layerGroup, [[maybe_unused]] const RenderTree& renderTree, diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index f2e83ea1e64..45660f7938a 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #endif @@ -272,8 +271,8 @@ bool RenderCircleLayer::queryIntersectsFeature(const GeometryCoordinates& queryG namespace { constexpr auto CircleShaderGroupName = "CircleShader"; -static const StringIdentity idCircleInterpolateUBOName = StringIndexer::get("CircleInterpolateUBO"); -static const StringIdentity idVertexAttribName = StringIndexer::get("a_pos"); +const StringIdentity idCircleInterpolateUBOName = stringIndexer().get("CircleInterpolateUBO"); +const StringIdentity idVertexAttribName = stringIndexer().get("a_pos"); } // namespace diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 8b1200b4e41..bf1c0452cea 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -39,10 +39,10 @@ using namespace shaders; namespace { #if MLN_DRAWABLE_RENDERER -static const StringIdentity idPosAttribName = StringIndexer::get("a_pos"); -static const StringIdentity idNormAttribName = StringIndexer::get("a_normal_ed"); +const StringIdentity idPosAttribName = stringIndexer().get("a_pos"); +const StringIdentity idNormAttribName = stringIndexer().get("a_normal_ed"); -static const StringIdentity idIconTextureName = StringIndexer::get("u_image"); +const StringIdentity idIconTextureName = stringIndexer().get("u_image"); #endif // MLN_DRAWABLE_RENDERER diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 4063c23c4be..0680ee68033 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -46,15 +46,14 @@ constexpr auto FillOutlineShaderName = "FillOutlineShader"; constexpr auto FillPatternShaderName = "FillPatternShader"; constexpr auto FillOutlinePatternShaderName = "FillOutlinePatternShader"; -static const StringIdentity idFillOutlineInterpolateUBOName = StringIndexer::get("FillOutlineInterpolateUBO"); -static const StringIdentity idFillPatternInterpolateUBOName = StringIndexer::get("FillPatternInterpolateUBO"); -static const StringIdentity idFillPatternTilePropsUBOName = StringIndexer::get("FillPatternTilePropsUBO"); -static const StringIdentity idFillOutlinePatternInterpolateUBOName = StringIndexer::get( - "FillOutlinePatternInterpolateUBO"); -static const StringIdentity idFillOutlinePatternTilePropsUBOName = StringIndexer::get("FillOutlinePatternTilePropsUBO"); - -static const StringIdentity idPosAttribName = StringIndexer::get("a_pos"); -static const StringIdentity idIconTextureName = StringIndexer::get("u_image"); +const StringIdentity idFillOutlineInterpolateUBOName = stringIndexer().get("FillOutlineInterpolateUBO"); +const StringIdentity idFillPatternInterpolateUBOName = stringIndexer().get("FillPatternInterpolateUBO"); +const StringIdentity idFillPatternTilePropsUBOName = stringIndexer().get("FillPatternTilePropsUBO"); +const StringIdentity idFillOutlinePatternInterpolateUBOName = stringIndexer().get("FillOutlinePatternInterpolateUBO"); +const StringIdentity idFillOutlinePatternTilePropsUBOName = stringIndexer().get("FillOutlinePatternTilePropsUBO"); + +const StringIdentity idPosAttribName = stringIndexer().get("a_pos"); +const StringIdentity idIconTextureName = stringIndexer().get("u_image"); #endif // MLN_DRAWABLE_RENDERER inline const FillLayer::Impl& impl_cast(const Immutable& impl) { @@ -609,6 +608,7 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, fillBuilder->setShader(fillShader); if (outlineBuilder) { fillBuilder->setVertexAttributes(vertexAttrs); + outlineBuilder->setVertexAttributes(std::move(vertexAttrs)); } else { fillBuilder->setVertexAttributes(std::move(vertexAttrs)); } @@ -621,7 +621,6 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, } if (outlineBuilder && bucket.sharedLines->elements()) { outlineBuilder->setShader(outlineShader); - outlineBuilder->setVertexAttributes(std::move(vertexAttrs)); outlineBuilder->setRawVertices({}, vertexCount, gfx::AttributeDataType::Short2); outlineBuilder->setSegments( gfx::Lines(2), bucket.sharedLines, bucket.lineSegments.data(), bucket.lineSegments.size()); @@ -704,6 +703,7 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, patternBuilder->setRenderPass(renderPass); if (outlinePatternBuilder) { patternBuilder->setVertexAttributes(vertexAttrs); + outlinePatternBuilder->setVertexAttributes(std::move(vertexAttrs)); } else { patternBuilder->setVertexAttributes(std::move(vertexAttrs)); } @@ -722,7 +722,6 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, if (outlinePatternBuilder && bucket.sharedLines->elements()) { outlinePatternBuilder->setShader(outlineShader); outlinePatternBuilder->setRenderPass(renderPass); - outlinePatternBuilder->setVertexAttributes(std::move(vertexAttrs)); outlinePatternBuilder->setRawVertices({}, vertexCount, gfx::AttributeDataType::Short2); outlinePatternBuilder->setSegments( gfx::Lines(2), bucket.sharedLines, bucket.lineSegments.data(), bucket.lineSegments.size()); diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index 7189c99d45b..f1eae101a76 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -280,10 +280,10 @@ namespace { constexpr auto HeatmapShaderGroupName = "HeatmapShader"; constexpr auto HeatmapTextureShaderGroupName = "HeatmapTextureShader"; -static const StringIdentity idHeatmapInterpolateUBOName = StringIndexer::get("HeatmapInterpolateUBO"); -static const StringIdentity idVertexAttribName = StringIndexer::get("a_pos"); -static const StringIdentity idTexImageName = StringIndexer::get("u_image"); -static const StringIdentity idTexColorRampName = StringIndexer::get("u_color_ramp"); +const StringIdentity idHeatmapInterpolateUBOName = stringIndexer().get("HeatmapInterpolateUBO"); +const StringIdentity idVertexAttribName = stringIndexer().get("a_pos"); +const StringIdentity idTexImageName = stringIndexer().get("u_image"); +const StringIdentity idTexColorRampName = stringIndexer().get("u_color_ramp"); } // namespace diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp index 6a1bcc19616..e5df0649cd5 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp @@ -299,9 +299,9 @@ void RenderHillshadeLayer::removeRenderTargets(UniqueChangeRequestVec& changes) static const std::string HillshadePrepareShaderGroupName = "HillshadePrepareShader"; static const std::string HillshadeShaderGroupName = "HillshadeShader"; -static const StringIdentity idPosAttribName = StringIndexer::get("a_pos"); -static const StringIdentity idTexturePosAttribName = StringIndexer::get("a_texture_pos"); -static const StringIdentity idTexImageName = StringIndexer::get("u_image"); +static const StringIdentity idPosAttribName = stringIndexer().get("a_pos"); +static const StringIdentity idTexturePosAttribName = stringIndexer().get("a_texture_pos"); +static const StringIdentity idTexImageName = stringIndexer().get("u_image"); void RenderHillshadeLayer::update(gfx::ShaderRegistry& shaders, gfx::Context& context, @@ -500,8 +500,7 @@ void RenderHillshadeLayer::update(gfx::ShaderRegistry& shaders, // Rebuild segments, since they're not shared. std::vector> drawSegments; drawSegments.reserve(segments->size()); - for (std::size_t i = 0; i < segments->size(); ++i) { - const auto& seg = segments->data()[i]; + for (const auto& seg : *segments) { auto segCopy = SegmentBase{ // no copy constructor seg.vertexOffset, diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index ee8f692ff20..7cc6c72997e 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -47,8 +47,8 @@ inline const LineLayer::Impl& impl_cast(const Immutable& imp #if MLN_DRAWABLE_RENDERER -static const StringIdentity idVertexAttribName = StringIndexer::get("a_pos_normal"); -static const StringIdentity idDataAttribName = StringIndexer::get("a_data"); +const StringIdentity idVertexAttribName = stringIndexer().get("a_pos_normal"); +const StringIdentity idDataAttribName = stringIndexer().get("a_data"); #endif // MLN_DRAWABLE_RENDERER @@ -357,15 +357,15 @@ float RenderLineLayer::getLineWidth(const GeometryTileFeature& feature, #if MLN_DRAWABLE_RENDERER /// Property interpolation UBOs -static const StringIdentity idLineInterpolationUBOName = StringIndexer::get("LineInterpolationUBO"); -static const StringIdentity idLineGradientInterpolationUBOName = StringIndexer::get("LineGradientInterpolationUBO"); -static const StringIdentity idLinePatternInterpolationUBOName = StringIndexer::get("LinePatternInterpolationUBO"); -static const StringIdentity idLineSDFInterpolationUBOName = StringIndexer::get("LineSDFInterpolationUBO"); +static const StringIdentity idLineInterpolationUBOName = stringIndexer().get("LineInterpolationUBO"); +static const StringIdentity idLineGradientInterpolationUBOName = stringIndexer().get("LineGradientInterpolationUBO"); +static const StringIdentity idLinePatternInterpolationUBOName = stringIndexer().get("LinePatternInterpolationUBO"); +static const StringIdentity idLineSDFInterpolationUBOName = stringIndexer().get("LineSDFInterpolationUBO"); /// Evaluated properties that depend on the tile -static const StringIdentity idLinePatternTilePropertiesUBOName = StringIndexer::get("LinePatternTilePropertiesUBO"); +static const StringIdentity idLinePatternTilePropertiesUBOName = stringIndexer().get("LinePatternTilePropertiesUBO"); -static const StringIdentity idLineImageUniformName = StringIndexer::get("u_image"); +static const StringIdentity idLineImageUniformName = stringIndexer().get("u_image"); void RenderLineLayer::update(gfx::ShaderRegistry& shaders, gfx::Context& context, diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp index 3f568b6a8ad..70abfbc719b 100644 --- a/src/mbgl/renderer/layers/render_raster_layer.cpp +++ b/src/mbgl/renderer/layers/render_raster_layer.cpp @@ -246,10 +246,10 @@ void RenderRasterLayer::layerIndexChanged(int32_t newLayerIndex, UniqueChangeReq changeLayerIndex(imageLayerGroup, newLayerIndex, changes); } -static const StringIdentity idPosAttribName = StringIndexer::get("a_pos"); -static const StringIdentity idTexturePosAttribName = StringIndexer::get("a_texture_pos"); -static const StringIdentity idTexImage0Name = StringIndexer::get("u_image0"); -static const StringIdentity idTexImage1Name = StringIndexer::get("u_image1"); +static const StringIdentity idPosAttribName = stringIndexer().get("a_pos"); +static const StringIdentity idTexturePosAttribName = stringIndexer().get("a_texture_pos"); +static const StringIdentity idTexImage0Name = stringIndexer().get("u_image0"); +static const StringIdentity idTexImage1Name = stringIndexer().get("u_image1"); void RenderRasterLayer::update(gfx::ShaderRegistry& shaders, gfx::Context& context, @@ -476,7 +476,7 @@ void RenderRasterLayer::update(gfx::ShaderRegistry& shaders, if (geometryChanged) { removeTile(renderPass, tileID); - cleared = true; + // cleared = true; } else if (0 < updated) { // If we modified drawables without removing them, we're done with this tile. continue; diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index 22562ab0989..753cad18e6e 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #endif // MLN_DRAWABLE_RENDERER @@ -749,14 +748,14 @@ SymbolDrawableTilePropsUBO buildTileUBO(const SymbolBucket& bucket, }; } -static const auto idDataAttibName = StringIndexer::get("a_data"); -static const auto posOffsetAttribName = "a_pos_offset"; -static const auto idPosOffsetAttribName = StringIndexer::get(posOffsetAttribName); -static const auto idPixOffsetAttribName = StringIndexer::get("a_pixeloffset"); -static const auto idProjPosAttribName = StringIndexer::get("a_projected_pos"); -static const auto idFadeOpacityAttribName = StringIndexer::get("a_fade_opacity"); -static const auto idTexUniformName = StringIndexer::get("u_texture"); -static const auto idTexIconUniformName = StringIndexer::get("u_texture_icon"); +const auto idDataAttibName = stringIndexer().get("a_data"); +const auto posOffsetAttribName = "a_pos_offset"; +const auto idPosOffsetAttribName = stringIndexer().get(posOffsetAttribName); +const auto idPixOffsetAttribName = stringIndexer().get("a_pixeloffset"); +const auto idProjPosAttribName = stringIndexer().get("a_projected_pos"); +const auto idFadeOpacityAttribName = stringIndexer().get("a_fade_opacity"); +const auto idTexUniformName = stringIndexer().get("u_texture"); +const auto idTexIconUniformName = stringIndexer().get("u_texture_icon"); void updateTileAttributes(const SymbolBucket::Buffer& buffer, const bool isText, @@ -866,11 +865,11 @@ void updateTileDrawable(gfx::Drawable& drawable, drawable.setVertexAttributes(std::move(attribs)); } -static const StringIdentity idCollisionPosAttribName = StringIndexer::get("a_pos"); -static const StringIdentity idCollisionAnchorPosAttribName = StringIndexer::get("a_anchor_pos"); -static const StringIdentity idCollisionExtrudeAttribName = StringIndexer::get("a_extrude"); -static const StringIdentity idCollisionPlacedAttribName = StringIndexer::get("a_placed"); -static const StringIdentity idCollisionShiftAttribName = StringIndexer::get("a_shift"); +const StringIdentity idCollisionPosAttribName = stringIndexer().get("a_pos"); +const StringIdentity idCollisionAnchorPosAttribName = stringIndexer().get("a_anchor_pos"); +const StringIdentity idCollisionExtrudeAttribName = stringIndexer().get("a_extrude"); +const StringIdentity idCollisionPlacedAttribName = stringIndexer().get("a_placed"); +const StringIdentity idCollisionShiftAttribName = stringIndexer().get("a_shift"); gfx::VertexAttributeArray getCollisionVertexAttributes(const SymbolBucket::CollisionBuffer& buffer, bool staticCopy) { gfx::VertexAttributeArray vertexAttrs; @@ -1144,7 +1143,7 @@ void RenderSymbolLayer::update(gfx::ShaderRegistry& shaders, const auto& collisionBox = isText ? bucket.textCollisionBox : bucket.iconCollisionBox; if (const auto shader = std::static_pointer_cast( collisionBoxGroup->getOrCreateShader( - context, {}, StringIndexer::get(idCollisionPosAttribName)))) { + context, {}, stringIndexer().get(idCollisionPosAttribName)))) { collisionBuilder->setDrawableName(layerCollisionPrefix + suffix + "box"); collisionBuilder->setShader(shader); addVertices(collisionBox->vertices().vector(), staticVertexAndAttributes); @@ -1162,7 +1161,7 @@ void RenderSymbolLayer::update(gfx::ShaderRegistry& shaders, const auto& collisionCircle = isText ? bucket.textCollisionCircle : bucket.iconCollisionCircle; if (const auto shader = std::static_pointer_cast( collisionCircleGroup->getOrCreateShader( - context, {}, StringIndexer::get(idCollisionPosAttribName)))) { + context, {}, stringIndexer().get(idCollisionPosAttribName)))) { collisionBuilder->setDrawableName(layerCollisionPrefix + suffix + "circle"); collisionBuilder->setShader(shader); addVertices(collisionCircle->vertices().vector(), staticVertexAndAttributes); diff --git a/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp b/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp index f2141af170f..40c9d32a909 100644 --- a/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp @@ -44,10 +44,10 @@ std::array toArray(const Size& s) { return util::cast(std::array{s.width, s.height}); } -const StringIdentity idTexUniformName = StringIndexer::get("u_texture"); -const StringIdentity idTexIconUniformName = StringIndexer::get("u_texture_icon"); -const StringIdentity idExpressionInputsUBOName = StringIndexer::get("ExpressionInputsUBO"); -const StringIdentity idSymbolPermutationUBOName = StringIndexer::get("SymbolPermutationUBO"); +const StringIdentity idTexUniformName = stringIndexer().get("u_texture"); +const StringIdentity idTexIconUniformName = stringIndexer().get("u_texture_icon"); +const StringIdentity idExpressionInputsUBOName = stringIndexer().get("ExpressionInputsUBO"); +const StringIdentity idSymbolPermutationUBOName = stringIndexer().get("SymbolPermutationUBO"); SymbolDrawablePaintUBO buildPaintUBO(bool isText, const SymbolPaintProperties::PossiblyEvaluated& evaluated) { return { @@ -64,12 +64,12 @@ SymbolDrawablePaintUBO buildPaintUBO(bool isText, const SymbolPaintProperties::P } // namespace -const StringIdentity SymbolLayerTweaker::idSymbolDrawableUBOName = StringIndexer::get("SymbolDrawableUBO"); -const StringIdentity SymbolLayerTweaker::idSymbolDynamicUBOName = StringIndexer::get("SymbolDynamicUBO"); -const StringIdentity SymbolLayerTweaker::idSymbolDrawablePaintUBOName = StringIndexer::get("SymbolDrawablePaintUBO"); -const StringIdentity SymbolLayerTweaker::idSymbolDrawableTilePropsUBOName = StringIndexer::get( +const StringIdentity SymbolLayerTweaker::idSymbolDrawableUBOName = stringIndexer().get("SymbolDrawableUBO"); +const StringIdentity SymbolLayerTweaker::idSymbolDynamicUBOName = stringIndexer().get("SymbolDynamicUBO"); +const StringIdentity SymbolLayerTweaker::idSymbolDrawablePaintUBOName = stringIndexer().get("SymbolDrawablePaintUBO"); +const StringIdentity SymbolLayerTweaker::idSymbolDrawableTilePropsUBOName = stringIndexer().get( "SymbolDrawableTilePropsUBO"); -const StringIdentity SymbolLayerTweaker::idSymbolDrawableInterpolateUBOName = StringIndexer::get( +const StringIdentity SymbolLayerTweaker::idSymbolDrawableInterpolateUBOName = stringIndexer().get( "SymbolDrawableInterpolateUBO"); void SymbolLayerTweaker::execute(LayerGroupBase& layerGroup, diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp index bc9773573b4..bdd34185e78 100644 --- a/src/mbgl/renderer/render_layer.cpp +++ b/src/mbgl/renderer/render_layer.cpp @@ -187,6 +187,7 @@ std::size_t RenderLayer::removeAllDrawables() { void RenderLayer::updateRenderTileIDs() { const auto oldMap = std::move(renderTileIDs); + renderTileIDs = std::unordered_map{}; if (renderTiles) { renderTileIDs.reserve(renderTiles->size()); for (const auto& tile : *renderTiles) { diff --git a/src/mbgl/renderer/sources/render_tile_source.cpp b/src/mbgl/renderer/sources/render_tile_source.cpp index fe81eec852f..c6904a4d4b1 100644 --- a/src/mbgl/renderer/sources/render_tile_source.cpp +++ b/src/mbgl/renderer/sources/render_tile_source.cpp @@ -67,8 +67,8 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr } // create a builder - static const StringIdentity idVertexAttribName = StringIndexer::get("a_pos"); - static const StringIdentity idDebugUBOName = StringIndexer::get("DebugUBO"); + static const StringIdentity idVertexAttribName = stringIndexer().get("a_pos"); + static const StringIdentity idDebugUBOName = stringIndexer().get("DebugUBO"); std::unique_ptr builder = context.createDrawableBuilder("debug-builder"); builder->setShader(debugShader); builder->setRenderPass(renderPass); @@ -109,7 +109,7 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr texture->setImage(emptyImage); texture->setSamplerConfiguration( {gfx::TextureFilterType::Linear, gfx::TextureWrapType::Clamp, gfx::TextureWrapType::Clamp}); - static const StringIdentity idDebugOverlayUniformName = StringIndexer::get("u_overlay"); + static const StringIdentity idDebugOverlayUniformName = stringIndexer().get("u_overlay"); samplerLocation = debugShader->getSamplerLocation(idDebugOverlayUniformName); } assert(samplerLocation.has_value()); diff --git a/src/mbgl/shaders/gl/shader_program_gl.cpp b/src/mbgl/shaders/gl/shader_program_gl.cpp index 364dd16f930..9688f1eeeb0 100644 --- a/src/mbgl/shaders/gl/shader_program_gl.cpp +++ b/src/mbgl/shaders/gl/shader_program_gl.cpp @@ -158,7 +158,7 @@ std::shared_ptr ShaderProgramGL::create(Context& context, MBGL_CHECK_ERROR(glGetActiveUniformBlockiv(program, index, GL_UNIFORM_BLOCK_DATA_SIZE, &size)); assert(length > 0 && size > 0); MBGL_CHECK_ERROR(glUniformBlockBinding(program, index, binding)); - uniformBlocks.add(StringIndexer::get(name.data()), index, size); + uniformBlocks.add(stringIndexer().get(name.data()), index, size); } SamplerLocationMap samplerLocations; @@ -178,7 +178,7 @@ std::shared_ptr ShaderProgramGL::create(Context& context, GLint location = MBGL_CHECK_ERROR(glGetUniformLocation(program, name.data())); assert(location != -1); if (location != -1) { - samplerLocations[StringIndexer::get(name.data())] = location; + samplerLocations[stringIndexer().get(name.data())] = location; } } } @@ -198,7 +198,7 @@ std::shared_ptr ShaderProgramGL::create(Context& context, continue; } const GLint location = MBGL_CHECK_ERROR(glGetAttribLocation(program, name.data())); - addAttr(attrs, StringIndexer::get(name.data()), location, length, size, glType); + addAttr(attrs, stringIndexer().get(name.data()), location, length, size, glType); } return std::make_shared( diff --git a/src/mbgl/shaders/mtl/shader_program.cpp b/src/mbgl/shaders/mtl/shader_program.cpp index 545b9c75e5b..75503f6daeb 100644 --- a/src/mbgl/shaders/mtl/shader_program.cpp +++ b/src/mbgl/shaders/mtl/shader_program.cpp @@ -31,7 +31,7 @@ shaders::AttributeInfo::AttributeInfo(std::size_t index_, dataType(dataType_), count(count_), name(name_), - nameID(StringIndexer::get(name_)) {} + nameID(stringIndexer().get(name_)) {} shaders::UniformBlockInfo::UniformBlockInfo( std::size_t index_, bool vertex_, bool fragment_, std::size_t size_, std::string_view name_) @@ -40,12 +40,12 @@ shaders::UniformBlockInfo::UniformBlockInfo( fragment(fragment_), size(size_), name(name_), - nameID(StringIndexer::get(name_)) {} + nameID(stringIndexer().get(name_)) {} shaders::TextureInfo::TextureInfo(std::size_t index_, std::string_view name_) : index(index_), name(name_), - nameID(StringIndexer::get(name_)) {} + nameID(stringIndexer().get(name_)) {} namespace mtl { namespace { @@ -206,7 +206,7 @@ void ShaderProgram::initAttribute(const shaders::AttributeInfo& info) { [&](auto, const gfx::VertexAttribute& attrib) { assert(attrib.getIndex() != index); }); uniformBlocks.visit([&](auto, const gfx::UniformBlock& block) { assert(block.getIndex() != index); }); #endif - vertexAttributes.add(StringIndexer::get(info.name), index, info.dataType, info.count); + vertexAttributes.add(stringIndexer().get(info.name), index, info.dataType, info.count); } void ShaderProgram::initUniformBlock(const shaders::UniformBlockInfo& info) { @@ -217,7 +217,7 @@ void ShaderProgram::initUniformBlock(const shaders::UniformBlockInfo& info) { [&](auto, const gfx::VertexAttribute& attrib) { assert(attrib.getIndex() != index); }); uniformBlocks.visit([&](auto, const gfx::UniformBlock& block) { assert(block.getIndex() != index); }); #endif - if (const auto& block_ = uniformBlocks.add(StringIndexer::get(info.name), index, info.size)) { + if (const auto& block_ = uniformBlocks.add(stringIndexer().get(info.name), index, info.size)) { auto& block = static_cast(*block_); block.setBindVertex(info.vertex); block.setBindFragment(info.fragment); @@ -225,7 +225,7 @@ void ShaderProgram::initUniformBlock(const shaders::UniformBlockInfo& info) { } void ShaderProgram::initTexture(const shaders::TextureInfo& info) { - textureBindings[StringIndexer::get(info.name.data())] = info.index; + textureBindings[stringIndexer().get(info.name.data())] = info.index; } } // namespace mtl diff --git a/src/mbgl/util/string_indexer.cpp b/src/mbgl/util/string_indexer.cpp index d5e8ea112b5..0ead2f6a6b6 100644 --- a/src/mbgl/util/string_indexer.cpp +++ b/src/mbgl/util/string_indexer.cpp @@ -19,10 +19,7 @@ StringIndexer::StringIndexer() { StringIdentity StringIndexer::get(std::string_view string) { { - std::shared_lock readerLock(instance().sharedMutex); - - const auto& stringToIdentity = instance().stringToIdentity; - [[maybe_unused]] const auto& identityToString = instance().identityToString; + std::shared_lock readerLock(sharedMutex); assert(stringToIdentity.size() == identityToString.size()); if (const auto it = stringToIdentity.find(string); it != stringToIdentity.end()) { @@ -31,15 +28,11 @@ StringIdentity StringIndexer::get(std::string_view string) { } { - std::unique_lock writerLock(instance().sharedMutex); - - auto& stringToIdentity = instance().stringToIdentity; - auto& identityToString = instance().identityToString; + std::unique_lock writerLock(sharedMutex); assert(stringToIdentity.size() == identityToString.size()); if (const auto it = stringToIdentity.find(string); it == stringToIdentity.end()) { // this writer to insert - auto& buffer = instance().buffer; const auto previousCapacity = buffer.capacity(); const StringIdentity id = identityToString.size(); @@ -67,30 +60,24 @@ StringIdentity StringIndexer::get(std::string_view string) { } std::string StringIndexer::get(const StringIdentity id) { - std::shared_lock readerLock(instance().sharedMutex); + std::shared_lock readerLock(sharedMutex); - const auto& identityToString = instance().identityToString; assert(id < identityToString.size()); - return id < identityToString.size() ? (instance().buffer.data() + identityToString[id]) : empty; -} - -void StringIndexer::clear() { - std::unique_lock writerLock(instance().sharedMutex); - - instance().stringToIdentity.clear(); - instance().identityToString.clear(); - instance().buffer.clear(); + return id < identityToString.size() ? (buffer.data() + identityToString[id]) : empty; } size_t StringIndexer::size() { - std::shared_lock readerLock(instance().sharedMutex); + std::shared_lock readerLock(sharedMutex); - [[maybe_unused]] auto& stringToIdentity = instance().stringToIdentity; - auto& identityToString = instance().identityToString; assert(stringToIdentity.size() == identityToString.size()); return identityToString.size(); } +StringIndexer& stringIndexer() { + static StringIndexer inst; + return inst; +} + } // namespace mbgl diff --git a/test/util/string_indexer.test.cpp b/test/util/string_indexer.test.cpp index f852992dd18..60ed60f6513 100644 --- a/test/util/string_indexer.test.cpp +++ b/test/util/string_indexer.test.cpp @@ -6,47 +6,51 @@ using namespace mbgl; +TEST(StringIndexer, SingletonStringIndexer) { + EXPECT_GE(stringIndexer().size(), 0); +} + TEST(StringIndexer, AddStrings) { - StringIndexer::clear(); - EXPECT_EQ(StringIndexer::size(), 0); + StringIndexer strIndexer; + EXPECT_EQ(strIndexer.size(), 0); - const auto id1 = StringIndexer::get("test string1"); + const auto id1 = strIndexer.get("test string1"); EXPECT_EQ(id1, 0); - EXPECT_EQ(StringIndexer::size(), 1); + EXPECT_EQ(strIndexer.size(), 1); const std::string_view s2 = "test string2"; - const auto id2 = StringIndexer::get(s2); + const auto id2 = strIndexer.get(s2); EXPECT_EQ(id2, 1); - EXPECT_EQ(StringIndexer::size(), 2); + EXPECT_EQ(strIndexer.size(), 2); } TEST(StringIndexer, GetString) { - StringIndexer::clear(); - EXPECT_EQ(StringIndexer::size(), 0); + StringIndexer strIndexer; + EXPECT_EQ(strIndexer.size(), 0); constexpr auto str = "test string1"; - const auto id1 = StringIndexer::get(str); + const auto id1 = strIndexer.get(str); EXPECT_EQ(id1, 0); - EXPECT_EQ(StringIndexer::size(), 1); + EXPECT_EQ(strIndexer.size(), 1); - const auto str1 = StringIndexer::get(id1); + const auto str1 = strIndexer.get(id1); EXPECT_EQ(str, str1); const auto str2 = str; - const auto id2 = StringIndexer::get(str2); + const auto id2 = strIndexer.get(str2); EXPECT_EQ(id1, id2); } TEST(StringIndexer, Reallocate) { - StringIndexer::clear(); - EXPECT_EQ(StringIndexer::size(), 0); + StringIndexer strIndexer; + EXPECT_EQ(strIndexer.size(), 0); constexpr auto str = "reallocate test string1"; - const auto id1 = StringIndexer::get(str); + const auto id1 = strIndexer.get(str); EXPECT_EQ(id1, 0); - EXPECT_EQ(StringIndexer::size(), 1); + EXPECT_EQ(strIndexer.size(), 1); // force reallocation. assume capacity: 100 strings, 100 * 32 bytes buffer space constexpr auto N = 1000; @@ -55,31 +59,31 @@ TEST(StringIndexer, Reallocate) { return "1234567890"s + "1234567890"s + "1234567890"s + "---" + std::to_string(i); }; for (auto i = 1; i < N; ++i) { - StringIndexer::get(string_for_i(i)); + strIndexer.get(string_for_i(i)); } - EXPECT_EQ(StringIndexer::size(), N); + EXPECT_EQ(strIndexer.size(), N); - const auto str1 = StringIndexer::get(id1); + const auto str1 = strIndexer.get(id1); EXPECT_EQ(str, str1); for (auto i = 1; i < N; ++i) { - const auto strN1 = StringIndexer::get(i); + const auto strN1 = strIndexer.get(i); EXPECT_EQ(strN1, string_for_i(i)); } } TEST(StringIndexer, GetOOBIdentity) { - StringIndexer::clear(); - EXPECT_EQ(StringIndexer::size(), 0); + StringIndexer strIndexer; + EXPECT_EQ(strIndexer.size(), 0); std::string str; #ifndef NDEBUG - EXPECT_DEATH_IF_SUPPORTED(str = StringIndexer::get(42), "id < identityToString.size()"); + EXPECT_DEATH_IF_SUPPORTED(str = strIndexer.get(42), "id < identityToString.size()"); #endif EXPECT_TRUE(str.empty()); #ifndef NDEBUG - EXPECT_DEATH_IF_SUPPORTED(str = StringIndexer::get(-1), "id < identityToString.size()"); + EXPECT_DEATH_IF_SUPPORTED(str = strIndexer.get(-1), "id < identityToString.size()"); #endif EXPECT_TRUE(str.empty()); }