Skip to content

Commit

Permalink
Merge branch 'main' into no-copy-defer
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSylvester authored Jan 14, 2025
2 parents 458175f + 79d625b commit 0ee7a79
Show file tree
Hide file tree
Showing 48 changed files with 468 additions and 321 deletions.
5 changes: 0 additions & 5 deletions .github/actions/qt5-build/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions .github/actions/qt5-build/action.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/actions/qt5-build/entrypoint.sh

This file was deleted.

70 changes: 16 additions & 54 deletions .github/workflows/qt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,64 +60,40 @@ jobs:
matrix:
include:
- name: Linux
os: ubuntu-22.04
build_type: RelWithDebInfo
qt_version: 5.15.2
qt_target: desktop
compiler: ""
- name: Linux
os: ubuntu-22.04
os: ubuntu-24.04
build_type: RelWithDebInfo
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
compiler: ""
- name: Linux_GCC13
os: ubuntu-24.04
build_type: RelWithDebInfo
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
compiler: "gcc-13"
- name: macOS
os: macos-13
build_type: RelWithDebInfo
qt_version: 5.15.2
qt_target: desktop
deployment_target: 10.15
deployment_arch: "x86_64"
compiler: ""
- name: macOS
os: macos-14
build_type: RelWithDebInfo
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
deployment_target: 11.0
deployment_target: 12.0
deployment_arch: "x86_64;arm64"
compiler: ""
- name: macOS_LLVM18
- name: macOS_LLVM
os: macos-14
build_type: RelWithDebInfo
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
deployment_target: 11.0
deployment_target: 12.0
deployment_arch: "arm64"
compiler: "llvm"
- name: win64_msvc2019
os: windows-2022
build_type: "RelWithDebInfo"
compiler_type: x64
compiler_version: 14.29
qt_version: 5.15.2
qt_target: desktop
qt_arch: win64_msvc2019_64
qt_tools: ""
- name: win64_msvc2019
- name: win64_msvc2022
os: windows-2022
build_type: "RelWithDebInfo"
compiler_type: x64
compiler_version: 14.29
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
qt_arch: win64_msvc2019_64
qt_arch: win64_msvc2022_64
qt_tools: ""
runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -200,11 +176,10 @@ jobs:
xcode-version: latest-stable

- name: Setup MSVC
if: matrix.qt_arch == 'win64_msvc2019_64'
if: matrix.qt_arch == 'win64_msvc2022_64'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.compiler_type }}
toolset: ${{ matrix.compiler_version }}

- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@v5
Expand All @@ -220,15 +195,6 @@ jobs:
tools: ${{ matrix.qt_tools }}
extra: --base https://mirrors.ocf.berkeley.edu/qt/

- name: Update ccache
if: runner.os == 'Windows'
shell: bash
run: |
# version is pinned due to issues with caching MSVC in 4.8
choco.exe install ccache --version=4.7.5 --no-progress
ccache.exe --version
echo "CCACHE_CONFIGPATH=C:/Users/runneradmin/AppData/Roaming/ccache/ccache.conf" >> "$GITHUB_ENV"
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1
with:
Expand All @@ -249,16 +215,12 @@ jobs:
-DMLN_WITH_QT=ON
ninja
- name: Build maplibre-native (Linux, Qt5)
if: runner.os == 'Linux' && matrix.qt_version == '5.15.2'
uses: ./source/.github/actions/qt5-build

- name: Build maplibre-native (Linux, Qt6)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler == ''
if: runner.os == 'Linux' && matrix.compiler == ''
uses: ./source/.github/actions/qt6-build

- name: Build maplibre-native (Linux, Qt6, custom compiler)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != ''
if: runner.os == 'Linux' && matrix.compiler != ''
run: |
mkdir build && cd build
qt-cmake ../source/ \
Expand All @@ -270,7 +232,7 @@ jobs:
ninja
- name: Build maplibre-native (Linux, Qt6, custom compiler, internal libraries)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != ''
if: runner.os == 'Linux' && matrix.compiler != ''
run: |
mkdir build-internal && cd build-internal
qt-cmake ../source/ \
Expand All @@ -284,7 +246,7 @@ jobs:
ninja
- name: Run tests (Linux)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != ''
if: runner.os == 'Linux' && matrix.compiler != ''
uses: coactions/setup-xvfb@v1
with:
run: ctest --output-on-failure
Expand Down
1 change: 1 addition & 0 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_library(
${PROJECT_SOURCE_DIR}/benchmark/src/mbgl/benchmark/benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/storage/offline_database.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/util/tilecover.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/util/color.benchmark.cpp
)

target_include_directories(
Expand Down
31 changes: 31 additions & 0 deletions benchmark/util/color.benchmark.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <benchmark/benchmark.h>

#include <string>
#include <vector>
#include <mbgl/util/color.hpp>

static const std::vector<std::string> testStrings = {"#000000",
"#FFFFFF",
"#FF00FFAA",
"rgba(255, 0, 0, 1.0)",
"rgb(0, 255, 0)",
"blue",
"red",
"invalid-color",
"rgba(255, 255, 255, 0.5)",
"#123"};

namespace {

void ColorParse(benchmark::State& state) {
for (auto _ : state) {
for (const auto& str : testStrings) {
auto result = mbgl::Color::parse(str);
benchmark::DoNotOptimize(result);
}
}
}

}; // namespace

BENCHMARK(ColorParse);
10 changes: 5 additions & 5 deletions benchmark/util/tilecover.benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static void TileCountBounds(benchmark::State& state) {
auto count = util::tileCount(sanFrancisco, 10);
length += count;
}
(void)length;
benchmark::DoNotOptimize(length);
}

static void TileCoverPitchedViewport(benchmark::State& state) {
Expand All @@ -29,7 +29,7 @@ static void TileCoverPitchedViewport(benchmark::State& state) {
auto tiles = util::tileCover(transform.getState(), 8);
length += tiles.size();
}
(void)length;
benchmark::DoNotOptimize(length);
}

static void TileCoverBounds(benchmark::State& state) {
Expand All @@ -38,7 +38,7 @@ static void TileCoverBounds(benchmark::State& state) {
auto tiles = util::tileCover(sanFrancisco, 8);
length += tiles.size();
}
(void)length;
benchmark::DoNotOptimize(length);
}

static const auto geomPolygon = Polygon<double>{
Expand All @@ -62,7 +62,7 @@ static void TileCoverPolygon(benchmark::State& state) {
auto tiles = util::tileCover(geomPolygon, 8);
length += tiles.size();
}
(void)length;
benchmark::DoNotOptimize(length);
}

static void TileCountPolygon(benchmark::State& state) {
Expand All @@ -72,7 +72,7 @@ static void TileCountPolygon(benchmark::State& state) {
auto tiles = util::tileCount(geomPolygon, 16);
length += tiles;
}
(void)length;
benchmark::DoNotOptimize(length);
}

BENCHMARK(TileCountBounds);
Expand Down
15 changes: 6 additions & 9 deletions include/mbgl/shaders/mtl/background.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
namespace mbgl {
namespace shaders {

#define BACKGROUND_SHADER_COMMON \
R"(
constexpr auto backgroundShaderPrelude = R"(
enum {
idBackgroundDrawableUBO = idDrawableReservedVertexOnlyUBO,
Expand Down Expand Up @@ -72,7 +71,7 @@ union BackgroundDrawableUnionUBO {
BackgroundPatternDrawableUBO backgroundPatternDrawableUBO;
};
)"
)";

template <>
struct ShaderSource<BuiltIn::BackgroundShader, gfx::Backend::Type::Metal> {
Expand All @@ -84,9 +83,8 @@ struct ShaderSource<BuiltIn::BackgroundShader, gfx::Backend::Type::Metal> {
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 0> textures;

static constexpr auto source = BACKGROUND_SHADER_COMMON R"(
#include <metal_stdlib>
using namespace metal;
static constexpr auto prelude = backgroundShaderPrelude;
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(backgroundUBOCount + 0)]];
Expand Down Expand Up @@ -128,9 +126,8 @@ struct ShaderSource<BuiltIn::BackgroundPatternShader, gfx::Backend::Type::Metal>
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

static constexpr auto source = BACKGROUND_SHADER_COMMON R"(
#include <metal_stdlib>
using namespace metal;
static constexpr auto prelude = backgroundShaderPrelude;
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(backgroundUBOCount + 0)]];
Expand Down
9 changes: 5 additions & 4 deletions include/mbgl/shaders/mtl/circle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
namespace mbgl {
namespace shaders {

#define CIRCLE_SHADER_PRELUDE \
R"(
constexpr auto circleShaderPrelude = R"(
enum {
idCircleDrawableUBO = idDrawableReservedVertexOnlyUBO,
Expand Down Expand Up @@ -51,7 +50,7 @@ struct alignas(16) CircleEvaluatedPropsUBO {
};
static_assert(sizeof(CircleEvaluatedPropsUBO) == 4 * 16, "wrong size");
)"
)";

template <>
struct ShaderSource<BuiltIn::CircleShader, gfx::Backend::Type::Metal> {
Expand All @@ -63,7 +62,9 @@ struct ShaderSource<BuiltIn::CircleShader, gfx::Backend::Type::Metal> {
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 0> textures;

static constexpr auto source = CIRCLE_SHADER_PRELUDE R"(
static constexpr auto prelude = circleShaderPrelude;
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(circleUBOCount + 0)]];
Expand Down
12 changes: 5 additions & 7 deletions include/mbgl/shaders/mtl/clipping_mask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ struct alignas(16) ClipUBO {
};
static_assert(sizeof(ClipUBO) == 5 * 16);

#define CLIPPING_MASK_SHADER_PRELUDE \
R"(
#include <metal_stdlib>
using namespace metal;
constexpr auto clippingMaskShaderPrelude = R"(
enum {
idClippingMaskUBO = idDrawableReservedVertexOnlyUBO,
Expand All @@ -37,7 +33,7 @@ struct alignas(16) ClipUBO {
};
static_assert(sizeof(ClipUBO) == 5 * 16, "wrong size");
)"
)";

template <>
struct ShaderSource<BuiltIn::ClippingMaskProgram, gfx::Backend::Type::Metal> {
Expand All @@ -49,7 +45,9 @@ struct ShaderSource<BuiltIn::ClippingMaskProgram, gfx::Backend::Type::Metal> {
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 0> textures;

static constexpr auto source = CLIPPING_MASK_SHADER_PRELUDE R"(
static constexpr auto prelude = clippingMaskShaderPrelude;
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(clippingMaskUBOCount + 0)]];
};
Expand Down
Loading

0 comments on commit 0ee7a79

Please sign in to comment.