From c4e225e752820b3bf1ab922f8f299b92731853f4 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:48:08 +0200 Subject: [PATCH 01/25] Update actionlint --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0f75dfdbe..0f7182fe9 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] From 2813b736a586e2b8ba3d2b095017f40aaec1fdf4 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:49:21 +0200 Subject: [PATCH 02/25] actionlint fixes --- .github/workflows/ios-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml index bae2e0d82..50e30b3da 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 From 4c4aef577d12486b34dd225ad225c57ea61d68e2 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:50:19 +0200 Subject: [PATCH 03/25] Fix drawable legacy matrix Linux CI --- .github/workflows/linux-ci.yml | 103 ++++++--------------------------- 1 file changed, 17 insertions(+), 86 deletions(-) diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 93713e05a..a6053b7aa 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_Large_Runner @@ -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,89 +99,14 @@ 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 - - - 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 + # unit tests - run: chmod +x ./mbgl-test-runner - name: Run C++ tests run: xvfb-run -a ./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 - - - uses: actions/checkout@v4 - - - name: Download mbgl-render-test-runner - uses: actions/download-artifact@v3 - with: - name: mbgl-render-test-runner + # render tests - run: chmod +x ./mbgl-render-test-runner @@ -195,6 +121,13 @@ jobs: name: render-test-result path: | metrics/linux-gcc8-release-style.html + + # expression tests + + - run: chmod +x ./mbgl-expression-test + + - name: Run expression test + run: ./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 From fff996d7cb7a0eb722804ab7bc23cf2d40ec3a01 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:14:27 +0000 Subject: [PATCH 04/25] remove duplicate include, remove redundant static --- .../drawable_custom_layer_host_tweaker.cpp | 2 -- .../renderer/layers/render_line_layer.cpp | 4 +-- .../renderer/layers/render_symbol_layer.cpp | 25 +++++++++---------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/mbgl/gfx/drawable_custom_layer_host_tweaker.cpp b/src/mbgl/gfx/drawable_custom_layer_host_tweaker.cpp index 8700642ce..6a19ac676 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/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index 9f0760312..35dd69c66 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 diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index f32d91a31..df043b819 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,13 +748,13 @@ SymbolDrawableTilePropsUBO buildTileUBO(const SymbolBucket& bucket, }; } -static const StringIdentity idDataAttibName = StringIndexer::get("a_data"); -static const StringIdentity idPosOffsetAttribName = StringIndexer::get("a_pos_offset"); -static const StringIdentity idPixOffsetAttribName = StringIndexer::get("a_pixeloffset"); -static const StringIdentity idProjPosAttribName = StringIndexer::get("a_projected_pos"); -static const StringIdentity idFadeOpacityAttribName = StringIndexer::get("a_fade_opacity"); -static const StringIdentity idTexUniformName = StringIndexer::get("u_texture"); -static const StringIdentity idTexIconUniformName = StringIndexer::get("u_texture_icon"); +const StringIdentity idDataAttibName = StringIndexer::get("a_data"); +const StringIdentity idPosOffsetAttribName = StringIndexer::get("a_pos_offset"); +const StringIdentity idPixOffsetAttribName = StringIndexer::get("a_pixeloffset"); +const StringIdentity idProjPosAttribName = StringIndexer::get("a_projected_pos"); +const StringIdentity idFadeOpacityAttribName = StringIndexer::get("a_fade_opacity"); +const StringIdentity idTexUniformName = StringIndexer::get("u_texture"); +const StringIdentity idTexIconUniformName = StringIndexer::get("u_texture_icon"); std::vector updateTileAttributes(const SymbolBucket::Buffer& buffer, const bool isText, @@ -863,11 +862,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; From c873b4db42b075775d5721dc20a6d0cfe005d943 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:15:30 +0000 Subject: [PATCH 05/25] disable MLN_LEGACY_RENDERER when MLN_DRAWABLE_RENDERER --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f35ec847..fdaede69f 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 From 6f7e9f44e7d05f654579c541b9da5de0ab3a207a Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:15:42 +0000 Subject: [PATCH 06/25] make disabled member public --- include/mbgl/gfx/vertex_attribute.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/mbgl/gfx/vertex_attribute.hpp b/include/mbgl/gfx/vertex_attribute.hpp index 17c0c53e4..df7b9f334 100644 --- a/include/mbgl/gfx/vertex_attribute.hpp +++ b/include/mbgl/gfx/vertex_attribute.hpp @@ -238,8 +238,9 @@ public: 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; From 23d521eb11b06f394e90071603920eb534de622e Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:15:57 +0000 Subject: [PATCH 07/25] fix overshadowed member --- src/mbgl/gl/drawable_gl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mbgl/gl/drawable_gl.cpp b/src/mbgl/gl/drawable_gl.cpp index 314243ff0..f994f599b 100644 --- a/src/mbgl/gl/drawable_gl.cpp +++ b/src/mbgl/gl/drawable_gl.cpp @@ -122,10 +122,10 @@ void DrawableGL::bindUniformBuffers() const { const auto& uniformBuffer = getUniformBuffers().get(element.first); if (!uniformBuffer) { using namespace std::string_literals; - const auto tileID = getTileID() ? util::toString(*getTileID()) : ""; + const auto currTileID = getTileID() ? util::toString(*getTileID()) : ""; Log::Error(Event::General, "bindUniformBuffers: UBO "s + std::string(StringIndexer::get(element.first)) + - " not found for " + util::toString(getID()) + " / " + getName() + " / " + tileID + + " not found for " + util::toString(getID()) + " / " + getName() + " / " + currTileID + ". skipping."); assert(false); continue; From 0594fdc0a6dcd4775a6b5a55dcc17180e170caf0 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:16:06 +0000 Subject: [PATCH 08/25] fix use after move --- src/mbgl/renderer/render_layer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp index bc9773573..04c11139d 100644 --- a/src/mbgl/renderer/render_layer.cpp +++ b/src/mbgl/renderer/render_layer.cpp @@ -186,7 +186,7 @@ std::size_t RenderLayer::removeAllDrawables() { } void RenderLayer::updateRenderTileIDs() { - const auto oldMap = std::move(renderTileIDs); + const auto oldMap = renderTileIDs; if (renderTiles) { renderTileIDs.reserve(renderTiles->size()); for (const auto& tile : *renderTiles) { From 3032723ba38cf04449c34d1d992dc6da8151e652 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:27:23 +0000 Subject: [PATCH 09/25] remove redundant static --- src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 62b5c477c..ba6c69b01 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 From eebbaf3b0b248e0624d7e5e7009dbd4e131fa363 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:30:47 +0000 Subject: [PATCH 10/25] Fix unneeded use of operator[] --- src/mbgl/renderer/layers/render_hillshade_layer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp index 6a1bcc196..fcacaa213 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp @@ -501,7 +501,7 @@ void RenderHillshadeLayer::update(gfx::ShaderRegistry& shaders, std::vector> drawSegments; drawSegments.reserve(segments->size()); for (std::size_t i = 0; i < segments->size(); ++i) { - const auto& seg = segments->data()[i]; + const auto& seg = segments[i]; auto segCopy = SegmentBase{ // no copy constructor seg.vertexOffset, From de2c42403ca319d69f03965299f2216ad6df1ebf Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:47:49 +0000 Subject: [PATCH 11/25] fix unused variable --- src/mbgl/renderer/layers/render_raster_layer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp index 3f568b6a8..c28ff1e25 100644 --- a/src/mbgl/renderer/layers/render_raster_layer.cpp +++ b/src/mbgl/renderer/layers/render_raster_layer.cpp @@ -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; From 536e577f549ec93cfb6918a580b944011b259c6e Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:49:17 +0000 Subject: [PATCH 12/25] remove redundant static and move after free triggered --- src/mbgl/renderer/layers/render_fill_layer.cpp | 17 ++++++++--------- .../renderer/layers/render_heatmap_layer.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 02176fdb7..a062cb375 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"); +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"); -static const StringIdentity idPosAttribName = StringIndexer::get("a_pos"); -static const StringIdentity idIconTextureName = StringIndexer::get("u_image"); +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) { @@ -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 aade91552..6264c29f2 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 From 8cbb49ce235186dd4870963641c1a3d82a9ea69c Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 12:14:07 +0000 Subject: [PATCH 13/25] Use range based for loop --- src/mbgl/renderer/layers/render_hillshade_layer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp index fcacaa213..dc2eab0b0 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp @@ -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[i]; + for (const auto& seg : *segments) { auto segCopy = SegmentBase{ // no copy constructor seg.vertexOffset, From 86675fbf3875e189c0e790ba37cd3c9c436f7826 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 12:14:19 +0000 Subject: [PATCH 14/25] Remove duplicate include --- src/mbgl/renderer/layers/render_circle_layer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index 27aa14606..57ace7043 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 From 82feff83da683f90caa927d51686326117097b94 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 12:14:55 +0000 Subject: [PATCH 15/25] Fix detected use after move --- src/mbgl/renderer/layers/render_fill_layer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index a062cb375..4e585aa36 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -608,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)); } @@ -620,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()); From a8a10a8d02cb38c9eb2c94462c893954ecb95b96 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 12:46:24 +0000 Subject: [PATCH 16/25] fix path test executables linux --- .github/workflows/linux-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 7749321ec..5892d84ea 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -101,18 +101,18 @@ jobs: # unit tests - - 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 # render tests - - 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-gcc8-release-style.json - name: Upload render test result if: always() && steps.render_test.outcome == 'failure' @@ -124,10 +124,10 @@ jobs: # expression tests - - run: chmod +x ./mbgl-expression-test + - run: chmod +x build/mbgl-expression-test - name: Run expression test - run: ./mbgl-expression-test + run: build/mbgl-expression-test linux-coverage: runs-on: ubuntu-22.04 From 8da7c50ef6defc9973967636d0c7a4ca6527daf2 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 12:46:42 +0000 Subject: [PATCH 17/25] increase timeout iOS tests --- platform/ios/test/BUILD.bazel | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/ios/test/BUILD.bazel b/platform/ios/test/BUILD.bazel index a29bf7461..2809711f5 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", ], ) From 0a501f28b7136f0d091471142c88b68ade52e4f6 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 17:18:02 +0200 Subject: [PATCH 18/25] fix path expression-test --- .github/workflows/linux-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 5892d84ea..4ea1409ea 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -124,10 +124,10 @@ jobs: # expression tests - - run: chmod +x build/mbgl-expression-test + - run: chmod +x build/expression-test/mbgl-expression-test - name: Run expression test - run: build/mbgl-expression-test + run: build/expression-test/mbgl-expression-test linux-coverage: runs-on: ubuntu-22.04 From 43bafd281982aacab76a77021fb2c9fcf70aad99 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 17:38:45 +0000 Subject: [PATCH 19/25] renderTileIDs.clear() --- src/mbgl/renderer/render_layer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp index 04c11139d..1bd83fdc4 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 = renderTileIDs; + renderTileIDs.clear(); if (renderTiles) { renderTileIDs.reserve(renderTiles->size()); for (const auto& tile : *renderTiles) { From 0a814689396f1ad3d6cf5964ff93c63dd153dc91 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Wed, 4 Oct 2023 12:47:17 +0000 Subject: [PATCH 20/25] Make StringIndexer not a singleton --- include/mbgl/gfx/vertex_attribute.hpp | 2 +- include/mbgl/util/string_indexer.hpp | 36 ++++++-------- src/mbgl/gfx/drawable_builder.cpp | 2 +- src/mbgl/gl/drawable_gl.cpp | 2 +- src/mbgl/gl/drawable_gl_impl.hpp | 2 +- src/mbgl/gl/upload_pass.cpp | 2 +- src/mbgl/mtl/drawable.cpp | 4 +- src/mbgl/mtl/drawable_impl.hpp | 2 +- .../layers/background_layer_tweaker.cpp | 6 +-- .../renderer/layers/circle_layer_tweaker.cpp | 10 ++-- .../layers/collision_layer_tweaker.cpp | 4 +- .../layers/fill_extrusion_layer_tweaker.cpp | 14 +++--- .../renderer/layers/fill_layer_tweaker.cpp | 47 +++++++++--------- .../renderer/layers/heatmap_layer_tweaker.cpp | 8 ++-- .../layers/heatmap_texture_layer_tweaker.cpp | 2 +- .../layers/hillshade_layer_tweaker.cpp | 4 +- .../hillshade_prepare_layer_tweaker.cpp | 2 +- .../renderer/layers/line_layer_tweaker.cpp | 22 ++++----- .../renderer/layers/raster_layer_tweaker.cpp | 2 +- .../renderer/layers/render_circle_layer.cpp | 4 +- .../layers/render_fill_extrusion_layer.cpp | 6 +-- .../renderer/layers/render_fill_layer.cpp | 14 +++--- .../renderer/layers/render_heatmap_layer.cpp | 8 ++-- .../layers/render_hillshade_layer.cpp | 6 +-- .../renderer/layers/render_line_layer.cpp | 16 +++---- .../renderer/layers/render_raster_layer.cpp | 8 ++-- .../renderer/layers/render_symbol_layer.cpp | 30 ++++++------ .../renderer/layers/symbol_layer_tweaker.cpp | 18 +++---- .../renderer/sources/render_tile_source.cpp | 6 +-- src/mbgl/shaders/gl/shader_program_gl.cpp | 6 +-- src/mbgl/shaders/mtl/shader_program.cpp | 6 +-- src/mbgl/util/string_indexer.cpp | 33 ++++++------- test/util/string_indexer.test.cpp | 48 +++++++++---------- 33 files changed, 186 insertions(+), 196 deletions(-) diff --git a/include/mbgl/gfx/vertex_attribute.hpp b/include/mbgl/gfx/vertex_attribute.hpp index df7b9f334..df19b976f 100644 --- a/include/mbgl/gfx/vertex_attribute.hpp +++ b/include/mbgl/gfx/vertex_attribute.hpp @@ -384,7 +384,7 @@ public: auto& attributeNameID = DataDrivenPaintProperty::AttributeNameIDs[attrIndex]; if (!attributeNameID) { static const std::string attributePrefix = "a_"; - attributeNameID = StringIndexer::get(attributePrefix + attributeName.data()); + attributeNameID = stringIndexer().get(attributePrefix + attributeName.data()); } if (auto& attr = getOrAdd(*attributeNameID)) { diff --git a/include/mbgl/util/string_indexer.hpp b/include/mbgl/util/string_indexer.hpp index 8cd5afbd3..1067a32b0 100644 --- a/include/mbgl/util/string_indexer.hpp +++ b/include/mbgl/util/string_indexer.hpp @@ -15,36 +15,30 @@ using StringIdentity = size_t; class StringIndexer { public: + StringIndexer(); + StringIndexer(StringIndexer const&) = delete; StringIndexer(StringIndexer&&) = delete; void operator=(StringIndexer const&) = delete; - - static StringIdentity get(std::string_view); - - static std::string get(const StringIdentity id); - - static void clear(); - - static size_t size(); - -protected: - StringIndexer(); ~StringIndexer() = default; - using MapType = std::unordered_map; - using VectorType = std::vector; - using BufferType = std::vector; + StringIdentity get(std::string_view); - static StringIndexer& instance() { - static StringIndexer inst; - return inst; - } + std::string get(const StringIdentity id); - MapType stringToIdentity; - VectorType identityToString; - BufferType buffer; + void clear(); + + size_t size(); + +protected: + std::unordered_map stringToIdentity; + std::vector identityToString; + std::vector buffer; std::shared_mutex sharedMutex; }; +/// StringIndexer singleton +StringIndexer& stringIndexer(); + } // namespace mbgl diff --git a/src/mbgl/gfx/drawable_builder.cpp b/src/mbgl/gfx/drawable_builder.cpp index 22d34acb5..08a1c7c78 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/gl/drawable_gl.cpp b/src/mbgl/gl/drawable_gl.cpp index f994f599b..e93dc3eb5 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 currTileID = 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() + " / " + currTileID + ". skipping."); assert(false); diff --git a/src/mbgl/gl/drawable_gl_impl.hpp b/src/mbgl/gl/drawable_gl_impl.hpp index 7cab156fc..5d4c4e21d 100644 --- a/src/mbgl/gl/drawable_gl_impl.hpp +++ b/src/mbgl/gl/drawable_gl_impl.hpp @@ -51,7 +51,7 @@ public: 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/upload_pass.cpp b/src/mbgl/gl/upload_pass.cpp index ce08a36b2..2d1c1ba90 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 89e36092b..e4d5aaf67 100644 --- a/src/mbgl/mtl/drawable.cpp +++ b/src/mbgl/mtl/drawable.cpp @@ -311,7 +311,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); } } @@ -380,7 +380,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 ef386fe44..b54d990d2 100644 --- a/src/mbgl/mtl/drawable_impl.hpp +++ b/src/mbgl/mtl/drawable_impl.hpp @@ -52,7 +52,7 @@ public: 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 d4ee0b033..5b063d8e7 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 f328743b5..2f6a0a2b8 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 508f16888..006424ead 100644 --- a/src/mbgl/renderer/layers/collision_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/collision_layer_tweaker.cpp @@ -31,8 +31,8 @@ static_assert(sizeof(CollisionUBO) == 20 * 4); } // namespace -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 f5add4533..6678b784d 100644 --- a/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp @@ -22,17 +22,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 f7ed4cd0a..fe35add32 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"); +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( +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 f4b44c468..e3c390ba4 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 d7542bbbd..8efc1645d 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 7e030ba36..786858516 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 d8971b00a..d445c192b 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 9bd15fac5..918087231 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 2854f82dd..6d4a38ed8 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 57ace7043..6123bdcd1 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -271,8 +271,8 @@ bool RenderCircleLayer::queryIntersectsFeature(const GeometryCoordinates& queryG namespace { constexpr auto CircleShaderGroupName = "CircleShader"; -const StringIdentity idCircleInterpolateUBOName = StringIndexer::get("CircleInterpolateUBO"); -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 ba6c69b01..5e481b159 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 -const StringIdentity idPosAttribName = StringIndexer::get("a_pos"); -const StringIdentity idNormAttribName = StringIndexer::get("a_normal_ed"); +const StringIdentity idPosAttribName = stringIndexer().get("a_pos"); +const StringIdentity idNormAttribName = stringIndexer().get("a_normal_ed"); -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 4e585aa36..42892093c 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -46,14 +46,14 @@ constexpr auto FillOutlineShaderName = "FillOutlineShader"; constexpr auto FillPatternShaderName = "FillPatternShader"; constexpr auto FillOutlinePatternShaderName = "FillOutlinePatternShader"; -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 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"); +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) { diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index 6264c29f2..f6e258372 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"; -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"); +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 dc2eab0b0..e5df0649c 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, diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index 35dd69c66..8cea128c0 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 -const StringIdentity idVertexAttribName = StringIndexer::get("a_pos_normal"); -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 @@ -351,15 +351,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 c28ff1e25..70abfbc71 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, diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index df043b819..ea2d69e91 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -748,13 +748,13 @@ SymbolDrawableTilePropsUBO buildTileUBO(const SymbolBucket& bucket, }; } -const StringIdentity idDataAttibName = StringIndexer::get("a_data"); -const StringIdentity idPosOffsetAttribName = StringIndexer::get("a_pos_offset"); -const StringIdentity idPixOffsetAttribName = StringIndexer::get("a_pixeloffset"); -const StringIdentity idProjPosAttribName = StringIndexer::get("a_projected_pos"); -const StringIdentity idFadeOpacityAttribName = StringIndexer::get("a_fade_opacity"); -const StringIdentity idTexUniformName = StringIndexer::get("u_texture"); -const StringIdentity idTexIconUniformName = StringIndexer::get("u_texture_icon"); +const StringIdentity idDataAttibName = stringIndexer().get("a_data"); +const StringIdentity idPosOffsetAttribName = stringIndexer().get("a_pos_offset"); +const StringIdentity idPixOffsetAttribName = stringIndexer().get("a_pixeloffset"); +const StringIdentity idProjPosAttribName = stringIndexer().get("a_projected_pos"); +const StringIdentity idFadeOpacityAttribName = stringIndexer().get("a_fade_opacity"); +const StringIdentity idTexUniformName = stringIndexer().get("u_texture"); +const StringIdentity idTexIconUniformName = stringIndexer().get("u_texture_icon"); std::vector updateTileAttributes(const SymbolBucket::Buffer& buffer, const bool isText, @@ -862,11 +862,11 @@ void updateTileDrawable(gfx::Drawable& drawable, drawable.setVertexAttributes(std::move(attribs)); } -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"); +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; @@ -1139,7 +1139,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); @@ -1157,7 +1157,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); @@ -1355,7 +1355,7 @@ void RenderSymbolLayer::update(gfx::ShaderRegistry& shaders, return; } const auto shader = std::static_pointer_cast(shaderGroup->getOrCreateShader( - context, propertiesAsUniforms, StringIndexer::get(idPosOffsetAttribName))); + context, propertiesAsUniforms, stringIndexer().get(idPosOffsetAttribName))); if (!shader) { return; } diff --git a/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp b/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp index 21ad4983b..770145741 100644 --- a/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp @@ -43,10 +43,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 { @@ -63,12 +63,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/sources/render_tile_source.cpp b/src/mbgl/renderer/sources/render_tile_source.cpp index fe81eec85..c6904a4d4 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 364dd16f9..9688f1eee 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 bb07378ae..830a4d7d0 100644 --- a/src/mbgl/shaders/mtl/shader_program.cpp +++ b/src/mbgl/shaders/mtl/shader_program.cpp @@ -182,7 +182,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) { @@ -193,7 +193,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); @@ -201,7 +201,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 d5e8ea112..19ffde6a2 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,32 @@ 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; + return id < identityToString.size() ? (buffer.data() + identityToString[id]) : empty; } void StringIndexer::clear() { - std::unique_lock writerLock(instance().sharedMutex); + std::unique_lock writerLock(sharedMutex); - instance().stringToIdentity.clear(); - instance().identityToString.clear(); - instance().buffer.clear(); + stringToIdentity.clear(); + identityToString.clear(); + buffer.clear(); } 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 f852992dd..9155f44b8 100644 --- a/test/util/string_indexer.test.cpp +++ b/test/util/string_indexer.test.cpp @@ -7,46 +7,46 @@ using namespace mbgl; 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 +55,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()); } From 63720145e6972c45cb9468e2fc430df848a36dc4 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Wed, 4 Oct 2023 12:50:18 +0000 Subject: [PATCH 21/25] move renderTileIDs --- src/mbgl/renderer/render_layer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp index 1bd83fdc4..bdd34185e 100644 --- a/src/mbgl/renderer/render_layer.cpp +++ b/src/mbgl/renderer/render_layer.cpp @@ -186,8 +186,8 @@ std::size_t RenderLayer::removeAllDrawables() { } void RenderLayer::updateRenderTileIDs() { - const auto oldMap = renderTileIDs; - renderTileIDs.clear(); + const auto oldMap = std::move(renderTileIDs); + renderTileIDs = std::unordered_map{}; if (renderTiles) { renderTileIDs.reserve(renderTiles->size()); for (const auto& tile : *renderTiles) { From fa44043742e67c4a4e9e4cbb31e24f894209fa69 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Wed, 4 Oct 2023 13:55:36 +0000 Subject: [PATCH 22/25] Disable shader replacement tests --- test/renderer/shader_registry.test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/renderer/shader_registry.test.cpp b/test/renderer/shader_registry.test.cpp index ee362370a..caabf8a6c 100644 --- a/test/renderer/shader_registry.test.cpp +++ b/test/renderer/shader_registry.test.cpp @@ -207,7 +207,7 @@ TEST(ShaderRegistry, NamedReplace) { } // Test replacing an actual program instance with a similar instance -TEST(ShaderRegistry, GLSLReplacement_NoOp) { +TEST(ShaderRegistry, DISABLED_GLSLReplacement_NoOp) { MapInstance::ShaderAndStyleObserver observer; util::RunLoop runLoop; auto map = MapInstance(1.0f, observer); @@ -233,7 +233,7 @@ TEST(ShaderRegistry, GLSLReplacement_NoOp) { // Test replacing an actual program with a similar instance using a different // fragment shader -TEST(ShaderRegistry, GLSLReplacement1) { +TEST(ShaderRegistry, DISABLED_GLSLReplacement1) { MapInstance::ShaderAndStyleObserver observer; util::RunLoop runLoop; auto map = MapInstance(1.0f, observer); @@ -267,7 +267,7 @@ void main() { // Test replacing an actual program with a similar instance using a different // fragment shader -TEST(ShaderRegistry, GLSLReplacement2) { +TEST(ShaderRegistry, DISABLED_GLSLReplacement2) { MapInstance::ShaderAndStyleObserver observer; util::RunLoop runLoop; auto map = MapInstance(1.0f, observer); From 655e12a5b6b117a4caad52d127d86d6be1a22b9c Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Wed, 4 Oct 2023 14:00:40 +0000 Subject: [PATCH 23/25] Remove clear() method --- include/mbgl/util/string_indexer.hpp | 2 -- src/mbgl/util/string_indexer.cpp | 8 -------- test/util/string_indexer.test.cpp | 4 ++++ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/include/mbgl/util/string_indexer.hpp b/include/mbgl/util/string_indexer.hpp index 1067a32b0..bd4d8162c 100644 --- a/include/mbgl/util/string_indexer.hpp +++ b/include/mbgl/util/string_indexer.hpp @@ -26,8 +26,6 @@ public: std::string get(const StringIdentity id); - void clear(); - size_t size(); protected: diff --git a/src/mbgl/util/string_indexer.cpp b/src/mbgl/util/string_indexer.cpp index 19ffde6a2..0ead2f6a6 100644 --- a/src/mbgl/util/string_indexer.cpp +++ b/src/mbgl/util/string_indexer.cpp @@ -67,14 +67,6 @@ std::string StringIndexer::get(const StringIdentity id) { return id < identityToString.size() ? (buffer.data() + identityToString[id]) : empty; } -void StringIndexer::clear() { - std::unique_lock writerLock(sharedMutex); - - stringToIdentity.clear(); - identityToString.clear(); - buffer.clear(); -} - size_t StringIndexer::size() { std::shared_lock readerLock(sharedMutex); diff --git a/test/util/string_indexer.test.cpp b/test/util/string_indexer.test.cpp index 9155f44b8..60ed60f65 100644 --- a/test/util/string_indexer.test.cpp +++ b/test/util/string_indexer.test.cpp @@ -6,6 +6,10 @@ using namespace mbgl; +TEST(StringIndexer, SingletonStringIndexer) { + EXPECT_GE(stringIndexer().size(), 0); +} + TEST(StringIndexer, AddStrings) { StringIndexer strIndexer; EXPECT_EQ(strIndexer.size(), 0); From 9342f811315ad37422522c8fa84419088379c448 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Wed, 4 Oct 2023 16:12:22 +0000 Subject: [PATCH 24/25] Drawable metrics JSON with GFX probing disabled --- .github/workflows/linux-ci.yml | 2 +- metrics/linux-drawable.json | 15 +++++++++++++++ metrics/linux-legacy.json | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 metrics/linux-drawable.json create mode 100644 metrics/linux-legacy.json diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 4ea1409ea..a70cee1b4 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -112,7 +112,7 @@ jobs: - name: Run render test id: render_test - run: xvfb-run -a build/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' diff --git a/metrics/linux-drawable.json b/metrics/linux-drawable.json new file mode 100644 index 000000000..5a401d30d --- /dev/null +++ b/metrics/linux-drawable.json @@ -0,0 +1,15 @@ +{ + "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": [ + "probeNetwork" + ] +} diff --git a/metrics/linux-legacy.json b/metrics/linux-legacy.json new file mode 100644 index 000000000..e50a58969 --- /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" + ] +} From 34a29ef061e88b50e9306fab84c88e567a2b0a2f Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Thu, 5 Oct 2023 09:28:14 +0000 Subject: [PATCH 25/25] Fix offscreen texture filter type, ignore one render test --- metrics/ignores/linux-drawable.json | 3 +++ metrics/linux-drawable.json | 3 ++- src/mbgl/gl/offscreen_texture.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 metrics/ignores/linux-drawable.json diff --git a/metrics/ignores/linux-drawable.json b/metrics/ignores/linux-drawable.json new file mode 100644 index 000000000..0634f7d27 --- /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 index 5a401d30d..9359406dd 100644 --- a/metrics/linux-drawable.json +++ b/metrics/linux-drawable.json @@ -6,7 +6,8 @@ ], "ignore_paths": [ "ignores/platform-all.json", - "ignores/platform-linux.json" + "ignores/platform-linux.json", + "ignores/linux-drawable.json" ], "metric_path": "linux-gcc8-release", "probes": [ diff --git a/src/mbgl/gl/offscreen_texture.cpp b/src/mbgl/gl/offscreen_texture.cpp index 40e816317..88f719ce4 100644 --- a/src/mbgl/gl/offscreen_texture.cpp +++ b/src/mbgl/gl/offscreen_texture.cpp @@ -18,7 +18,7 @@ public: 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 }