Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Drawable / Legacy renderer matrix Linux CI #1720

Merged
merged 27 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c4e225e
Update actionlint
louwers Oct 3, 2023
2813b73
actionlint fixes
louwers Oct 3, 2023
4c4aef5
Fix drawable legacy matrix Linux CI
louwers Oct 3, 2023
2bc1a89
Merge branch 'main' into linux-ci
louwers Oct 3, 2023
fff996d
remove duplicate include, remove redundant static
louwers Oct 3, 2023
c873b4d
disable MLN_LEGACY_RENDERER when MLN_DRAWABLE_RENDERER
louwers Oct 3, 2023
6f7e9f4
make disabled member public
louwers Oct 3, 2023
23d521e
fix overshadowed member
louwers Oct 3, 2023
0594fdc
fix use after move
louwers Oct 3, 2023
3032723
remove redundant static
louwers Oct 3, 2023
eebbaf3
Fix unneeded use of operator[]
louwers Oct 3, 2023
de2c424
fix unused variable
louwers Oct 3, 2023
536e577
remove redundant static and move after free triggered
louwers Oct 3, 2023
8cbb49c
Use range based for loop
louwers Oct 3, 2023
86675fb
Remove duplicate include
louwers Oct 3, 2023
82feff8
Fix detected use after move
louwers Oct 3, 2023
a8a10a8
fix path test executables linux
louwers Oct 3, 2023
8da7c50
increase timeout iOS tests
louwers Oct 3, 2023
0a501f2
fix path expression-test
louwers Oct 3, 2023
43bafd2
renderTileIDs.clear()
louwers Oct 3, 2023
0a81468
Make StringIndexer not a singleton
louwers Oct 4, 2023
6372014
move renderTileIDs
louwers Oct 4, 2023
fa44043
Disable shader replacement tests
louwers Oct 4, 2023
655e12a
Remove clear() method
louwers Oct 4, 2023
9342f81
Drawable metrics JSON with GFX probing disabled
louwers Oct 4, 2023
34a29ef
Fix offscreen texture filter type, ignore one render test
louwers Oct 5, 2023
aeaaced
Merge remote-tracking branch 'origin' into linux-ci
louwers Oct 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
111 changes: 21 additions & 90 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions include/mbgl/gfx/vertex_attribute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/gl/shader_group_gl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
32 changes: 12 additions & 20 deletions include/mbgl/util/string_indexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string_view, StringIdentity>;
using VectorType = std::vector<std::size_t>;
using BufferType = std::vector<char>;

static StringIndexer& instance() {
static StringIndexer inst;
return inst;
}

MapType stringToIdentity;
VectorType identityToString;
BufferType buffer;
std::unordered_map<std::string_view, StringIdentity> stringToIdentity;
std::vector<StringIdentity> identityToString;
std::vector<char> buffer;

std::shared_mutex sharedMutex;
};

/// StringIndexer singleton
StringIndexer& stringIndexer();

} // namespace mbgl
3 changes: 3 additions & 0 deletions metrics/ignores/linux-drawable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"render-tests/regressions/mapbox-gl-js#3426": "https://github.com/maplibre/maplibre-native/issues/1734"
}
16 changes: 16 additions & 0 deletions metrics/linux-drawable.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
16 changes: 16 additions & 0 deletions metrics/linux-legacy.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
7 changes: 4 additions & 3 deletions platform/ios/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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 = [
Expand All @@ -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",
],
)

Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/gfx/drawable_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Impl>()) {}

Expand Down
Loading