Drawable Renderer (#1570)

This commit is contained in:
Bart Louwers
2023-08-31 13:06:09 +02:00
committed by Bart Louwers
parent e57c9e4695
commit f59141f319
14 changed files with 72 additions and 358 deletions

View File

@@ -26,8 +26,7 @@ on:
- "!**/*.md"
pull_request:
branches:
- main
- topic/drawable
- '*'
paths:
- CMakeLists.txt
- 'platform/android/**'

View File

@@ -32,8 +32,7 @@ on:
pull_request:
branches:
- main
- topic/drawable
- '*'
paths:
- CMakeLists.txt
- 'platform/ios/**'
@@ -142,10 +141,10 @@ jobs:
run: bazel run //platform/ios:lint-plists
- name: Running iOS tests
run: bazel test --//:renderer=${{ matrix.renderer }} //platform/ios/platform/ios/test:ios_test --test_output=errors
run: bazel test //platform/ios/test:ios_test --test_output=errors
- name: Running iOS UI tests
run: bazel test --//:renderer=${{ matrix.renderer }} //platform/ios/platform/ios/iosapp-UITests:uitest --test_output=errors
run: bazel test //platform/ios/iosapp-UITests:uitest --test_output=errors
# size test

View File

@@ -23,8 +23,7 @@ on:
pull_request:
branches:
- main
- topic/drawable
- '*'
paths:
- "src/**"
- "test/**"
@@ -232,8 +231,11 @@ jobs:
- name: Generate coverage report
run: |
bazel coverage --test_output=errors --combined_report=lcov --nobuild_runfile_links --local_test_jobs=1 --instrumentation_filter="//:mbgl-core" //test:core //render-test:render-test --//:maplibre_platform=linux --run_under=//platform/linux:startxwrapper
echo coverage_report=$(bazel info output_path)/_coverage/_coverage_report.dat >> $GITHUB_ENV
xvfb-run -a \
bazel coverage --combined_report=lcov --instrumentation_filter="//:mbgl-core" --//:maplibre_platform=linux \
--test_output=errors --local_test_jobs=1 \
--test_env=DISPLAY --test_env=XAUTHORITY --copt="-DCI_BUILD" \
//test:core //expression-test:test
- name: Upload coverage report
if: '!cancelled()'

View File

@@ -33,8 +33,7 @@ on:
pull_request:
branches:
- main
- topic/drawable
- '*'
paths:
- CMakeLists.txt
- "platform/linux/**"

View File

@@ -12,10 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v3
# for debugging
- run: echo ${{ github.event }}
- uses: .github/actions/download-workflow-run-artifact
- uses: ./.github/actions/download-workflow-run-artifact
with:
artifact-name: size-test-result
expect-files: "./size"

View File

@@ -12,54 +12,41 @@ load(
"MLN_OPENGL_SOURCE",
"MLN_PRIVATE_GENERATED_STYLE_HEADERS",
"MLN_PUBLIC_GENERATED_STYLE_HEADERS",
"MLN_PRIVATE_GENERATED_STYLE_HEADERS",
"MLN_GENERATED_STYLE_SOURCE",
"MLN_GENERATED_SHADER_HEADERS",
"MLN_CORE_SOURCE",
"MLN_CORE_HEADERS",
"MLN_OPENGL_SOURCE",
"MLN_OPENGL_HEADERS",
"MLN_DRAWABLES_SOURCE",
"MLN_DRAWABLES_HEADERS",
)
load("//bazel:macros.bzl", "appendList")
# Generate code required by the core
# All generated code is placed in the prefix location __generated__
# by our generator scripts and genrules
PREFIXED = {
"MLN_PUBLIC_GENERATED_STYLE_HEADERS": appendList(MLN_PUBLIC_GENERATED_STYLE_HEADERS, "__generated__/"),
"MLN_PRIVATE_GENERATED_STYLE_HEADERS": appendList(MLN_PRIVATE_GENERATED_STYLE_HEADERS, "__generated__/"),
"MLN_GENERATED_STYLE_SOURCE": appendList(MLN_GENERATED_STYLE_SOURCE, "__generated__/"),
"MLN_GENERATED_SHADER_HEADERS": appendList(MLN_GENERATED_SHADER_HEADERS, "__generated__/"),
}
filegroup(
name = "style_data",
srcs = glob(["**/*.ejs"], allow_empty = False)
srcs = glob(
["**/*.ejs"],
allow_empty = False,
),
)
genrule(
name = "generated_style_code",
srcs = ["style_data"],
outs = MLN_PUBLIC_GENERATED_STYLE_HEADERS +
MLN_PRIVATE_GENERATED_STYLE_HEADERS +
MLN_GENERATED_STYLE_SOURCE,
cmd = "node $(execpath scripts/generate-style-code.js) --root $(RULEDIR)",
tools = ["scripts/generate-style-code.js"],
srcs = ["style_data"],
outs = PREFIXED["MLN_PUBLIC_GENERATED_STYLE_HEADERS"]
+ PREFIXED["MLN_PRIVATE_GENERATED_STYLE_HEADERS"]
+ PREFIXED["MLN_GENERATED_STYLE_SOURCE"],
)
filegroup(
name = "shader_data",
srcs = ["shaders/manifest.json"] + glob(["shaders/*.glsl"], allow_empty = False)
srcs = ["shaders/manifest.json"] + glob(
["shaders/*.glsl"],
allow_empty = False,
),
)
genrule(
name = "generated_shaders",
srcs = ["shader_data"],
outs = MLN_GENERATED_SHADER_HEADERS,
cmd = "node $(execpath shaders/generate_shader_code.js) --root $(RULEDIR)",
tools = ["shaders/generate_shader_code.js"],
srcs = ["shader_data"],
outs = PREFIXED["MLN_GENERATED_SHADER_HEADERS"],
)
# This header only target strips the __generated__ prefix for the compiler
@@ -67,13 +54,12 @@ genrule(
cc_library(
name = "mbgl-core-generated-public-artifacts",
srcs = [],
hdrs = PREFIXED["MLN_PUBLIC_GENERATED_STYLE_HEADERS"]
+ PREFIXED["MLN_GENERATED_SHADER_HEADERS"],
strip_include_prefix = "__generated__/include",
hdrs = MLN_PUBLIC_GENERATED_STYLE_HEADERS +
MLN_GENERATED_SHADER_HEADERS,
visibility = ["//visibility:public"],
deps = [
":generated_style_code",
":generated_shaders",
":generated_style_code",
],
)
@@ -81,8 +67,7 @@ cc_library(
cc_library(
name = "mbgl-core-generated-private-artifacts",
srcs = [],
hdrs = PREFIXED["MLN_PRIVATE_GENERATED_STYLE_HEADERS"],
strip_include_prefix = "__generated__/src",
hdrs = MLN_PRIVATE_GENERATED_STYLE_HEADERS,
visibility = ["//visibility:private"],
deps = [
":generated_style_code",
@@ -123,7 +108,7 @@ cc_library(
],
}) + select({
"//:ios": ["GLES_SILENCE_DEPRECATION=1"],
"//conditions:default": []
"//conditions:default": [],
}),
includes = [
"include",
@@ -134,8 +119,8 @@ cc_library(
],
visibility = ["//visibility:public"],
deps = [
":mbgl-core-generated-public-artifacts",
":mbgl-core-generated-private-artifacts",
":mbgl-core-generated-public-artifacts",
"//vendor:boost",
"//vendor:csscolorparser",
"//vendor:earcut.hpp",

View File

@@ -10,8 +10,8 @@ http_archive(
http_archive(
name = "rules_xcodeproj",
sha256 = "f836d2a516a911dc0ace44b1f51aa575613f149a934f4be1e7bd551a549672ff",
url = "https://github.com/MobileNativeFoundation/rules_xcodeproj/releases/download/1.7.1/release.tar.gz",
sha256 = "5baccdd6a2734a0adeb9cb6175691d0609f8bdbd7c5f516e828d0df744ee9f6c",
url = "https://github.com/MobileNativeFoundation/rules_xcodeproj/releases/download/1.9.1/release.tar.gz",
)
load(

View File

@@ -423,6 +423,7 @@ MLN_CORE_SOURCE = [
"src/mbgl/style/expression/match.cpp",
"src/mbgl/style/expression/number_format.cpp",
"src/mbgl/style/expression/parsing_context.cpp",
"src/mbgl/style/expression/slice.cpp",
"src/mbgl/style/expression/step.cpp",
"src/mbgl/style/expression/util.cpp",
"src/mbgl/style/expression/util.hpp",
@@ -627,7 +628,7 @@ MLN_CORE_SOURCE = [
"src/mbgl/util/utf.hpp",
"src/mbgl/util/version.cpp",
"src/mbgl/util/version.hpp",
"src/mbgl/util/work_request.cpp"
"src/mbgl/util/work_request.cpp",
]
MLN_CORE_HEADERS = [
@@ -747,6 +748,7 @@ MLN_CORE_HEADERS = [
"include/mbgl/style/expression/match.hpp",
"include/mbgl/style/expression/number_format.hpp",
"include/mbgl/style/expression/parsing_context.hpp",
"include/mbgl/style/expression/slice.hpp",
"include/mbgl/style/expression/step.hpp",
"include/mbgl/style/expression/type.hpp",
"include/mbgl/style/expression/value.hpp",
@@ -820,7 +822,7 @@ MLN_CORE_HEADERS = [
"include/mbgl/util/vectors.hpp",
"include/mbgl/util/work_request.hpp",
"include/mbgl/util/work_task.hpp",
"include/mbgl/util/work_task_impl.hpp"
"include/mbgl/util/work_task_impl.hpp",
]
MLN_OPENGL_SOURCE = [

View File

@@ -56,7 +56,6 @@ layout (std140) uniform LineSDFInterpolationUBO {
lowp float u_offset_t;
lowp float u_width_t;
lowp float u_floorwidth_t;
highp float pad2;
};
@@ -216,7 +215,6 @@ layout (std140) uniform LineSDFInterpolationUBO {
lowp float u_offset_t;
lowp float u_width_t;
lowp float u_floorwidth_t;
highp float pad2;
};

View File

@@ -1,4 +1,4 @@
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework", "apple_xcframework", "local_provisioning_profile")
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework", "apple_xcframework")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_framework")
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
load(
@@ -7,20 +7,18 @@ load(
"xcodeproj",
"xcode_schemes",
)
load("bazel/macros.bzl", "info_plist")
load("bazel/__generated__/provisioning_profile.bzl", "APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID", "APPLE_MOBILE_PROVISIONING_PROFILE_UUID")
local_provisioning_profile(
name = "provisioning_profile",
profile_name = APPLE_MOBILE_PROVISIONING_PROFILE_UUID,
team_id = APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID
)
xcode_provisioning_profile(
name = "xcode_profile",
managed_by_xcode = True,
provisioning_profile = ":provisioning_profile"
load("//platform/ios/bazel:macros.bzl", "info_plist")
load("//platform/ios/bazel:config.bzl", "BUILD_MODE", "BUNDLE_ID_PREFIX")
load(
"//platform/ios/bazel:files.bzl",
"MLN_IOS_PRIVATE_HEADERS",
"MLN_IOS_PUBLIC_HEADERS",
"MLN_IOS_PUBLIC_OBJCPP_SOURCE",
"MLN_IOS_PUBLIC_OBJC_SOURCE",
"MLN_IOS_SDK_HEADERS",
"MLN_PUBLIC_IOS_APP_SOPURCE",
)
load("//platform/ios/bazel:provisioning.bzl", "configure_device_profiles")
configure_device_profiles()
@@ -141,238 +139,7 @@ apple_resource_bundle(
"resources/*.lproj/**",
"resources/*.xcassets/**",
]),
)
# Objcpp files for the iOS source
objc_library(
name = "objcpp-sdk",
srcs = [
"platform/darwin/src/MLNAttributionInfo.mm",
"platform/darwin/src/MLNBackgroundStyleLayer.mm",
"platform/darwin/src/MLNCircleStyleLayer.mm",
"platform/darwin/src/MLNComputedShapeSource.mm",
"platform/darwin/src/MLNDefaultStyle.mm",
"platform/darwin/src/MLNFeature.mm",
"platform/darwin/src/MLNFillExtrusionStyleLayer.mm",
"platform/darwin/src/MLNFillStyleLayer.mm",
"platform/darwin/src/MLNForegroundStyleLayer.mm",
"platform/darwin/src/MLNFoundation.mm",
"platform/darwin/src/MLNGeometry.mm",
"platform/darwin/src/MLNHeatmapStyleLayer.mm",
"platform/darwin/src/MLNHillshadeStyleLayer.mm",
"platform/darwin/src/MLNImageSource.mm",
"platform/darwin/src/MLNLight.mm",
"platform/darwin/src/MLNLineStyleLayer.mm",
"platform/darwin/src/MLNLoggingConfiguration.mm",
"platform/darwin/src/MLNMapCamera.mm",
"platform/darwin/src/MLNMapSnapshotter.mm",
"platform/darwin/src/MLNMultiPoint.mm",
"platform/darwin/src/MLNNetworkConfiguration.mm",
"platform/darwin/src/MLNOfflinePack.mm",
"platform/darwin/src/MLNOfflineStorage.mm",
"platform/darwin/src/MLNOpenGLStyleLayer.mm",
"platform/darwin/src/MLNPointAnnotation.mm",
"platform/darwin/src/MLNPointCollection.mm",
"platform/darwin/src/MLNPolygon.mm",
"platform/darwin/src/MLNPolyline.mm",
"platform/darwin/src/MLNRasterDEMSource.mm",
"platform/darwin/src/MLNRasterStyleLayer.mm",
"platform/darwin/src/MLNRasterTileSource.mm",
"platform/darwin/src/MLNSettings.mm",
"platform/darwin/src/MLNShape.mm",
"platform/darwin/src/MLNShapeCollection.mm",
"platform/darwin/src/MLNShapeOfflineRegion.mm",
"platform/darwin/src/MLNShapeSource.mm",
"platform/darwin/src/MLNSource.mm",
"platform/darwin/src/MLNStyle.mm",
"platform/darwin/src/MLNStyleLayer.mm",
"platform/darwin/src/MLNStyleLayerManager.mm",
"platform/darwin/src/MLNStyleValue.mm",
"platform/darwin/src/MLNSymbolStyleLayer.mm",
"platform/darwin/src/MLNTilePyramidOfflineRegion.mm",
"platform/darwin/src/MLNTileServerOptions.mm",
"platform/darwin/src/MLNTileSource.mm",
"platform/darwin/src/MLNVectorStyleLayer.mm",
"platform/darwin/src/MLNVectorTileSource.mm",
"platform/darwin/src/NSArray+MLNAdditions.mm",
"platform/darwin/src/NSBundle+MLNAdditions.mm",
"platform/darwin/src/NSCoder+MLNAdditions.mm",
"platform/darwin/src/NSComparisonPredicate+MLNAdditions.mm",
"platform/darwin/src/NSCompoundPredicate+MLNAdditions.mm",
"platform/darwin/src/NSDate+MLNAdditions.mm",
"platform/darwin/src/NSDictionary+MLNAdditions.mm",
"platform/darwin/src/NSExpression+MLNAdditions.mm",
"platform/darwin/src/NSPredicate+MLNAdditions.mm",
"platform/darwin/src/NSValue+MLNStyleAttributeAdditions.mm",
"platform/ios/src/MLNAnnotationView.mm",
"platform/ios/src/MLNCompassButton.mm",
"platform/ios/src/MLNFaux3DUserLocationAnnotationView.mm",
"platform/ios/src/MLNMapAccessibilityElement.mm",
"platform/ios/src/MLNMapProjection.mm",
"platform/ios/src/MLNMapView.mm",
"platform/ios/src/MLNMapView+Impl.mm",
"platform/ios/src/MLNMapView+OpenGL.mm",
"platform/ios/src/MLNScaleBar.mm",
"platform/ios/src/UIColor+MLNAdditions.mm",
"platform/ios/src/UIImage+MLNAdditions.mm",
],
copts = CPP_FLAGS + MAPLIBRE_FLAGS + [
"-fcxx-modules",
"-fmodules",
"-Wno-c99-extensions",
"-Wno-gnu-zero-variadic-macro-arguments",
"-Wno-gnu-conditional-omitted-operand",
"-Wno-gnu-statement-expression",
],
includes = [
"platform/darwin/include",
],
sdk_frameworks = [
"CoreImage",
"CoreLocation",
"GLKit",
"OpenGLES",
"QuartzCore",
],
defines = ["GLES_SILENCE_DEPRECATION=1"],
deps = [
"objc-headers",
"//:mbgl-core",
"//platform/darwin:darwin-objcpp",
"//platform/default:mbgl-default",
"//platform/ios/platform/ios/vendor:SMCalloutView",
],
)
# platform/ios/sdk-files.json
# Objc files for the iOS source
objc_library(
name = "objc-sdk",
srcs = [
"platform/darwin/src/MLNAttributedExpression.m",
"platform/darwin/src/MLNClockDirectionFormatter.m",
"platform/darwin/src/MLNCompassDirectionFormatter.m",
"platform/darwin/src/MLNCoordinateFormatter.m",
"platform/darwin/src/MLNDistanceFormatter.m",
"platform/darwin/src/MLNLocationManager.m",
"platform/darwin/src/MLNReachability.m",
"platform/darwin/src/MLNRendererConfiguration.m",
"platform/darwin/src/MLNTypes.m",
"platform/darwin/src/NSString+MLNAdditions.m",
"platform/darwin/src/NSURL+MLNAdditions.m",
"platform/darwin/src/NSValue+MLNAdditions.m",
"platform/ios/src/MLNAnnotationContainerView.m",
"platform/ios/src/MLNAnnotationImage.m",
"platform/ios/src/MLNCompactCalloutView.m",
"platform/ios/src/MLNUserLocation.m",
"platform/ios/src/MLNUserLocationAnnotationView.m",
"platform/ios/src/MLNUserLocationAnnotationViewStyle.m",
"platform/ios/src/MLNUserLocationHeadingArrowLayer.m",
"platform/ios/src/MLNUserLocationHeadingBeamLayer.m",
"platform/ios/src/NSOrthography+MLNAdditions.m",
"platform/ios/src/UIDevice+MLNAdditions.m",
"platform/ios/src/UIView+MLNAdditions.m",
"platform/ios/src/UIViewController+MLNAdditions.m",
],
hdrs = [
"platform/darwin/include/mbgl/util/image+MLNAdditions.hpp",
],
copts = WARNING_FLAGS["ios"] + MAPLIBRE_FLAGS + [
"-fmodules",
"-Wno-gnu-zero-variadic-macro-arguments",
"-Wno-variadic-macros",
"-Wno-gnu-conditional-omitted-operand",
],
includes = [
"platform/darwin/include",
],
deps = [
"objc-headers",
"//:mbgl-core",
"//platform/darwin:darwin-objc",
"//platform/default:mbgl-default",
"//platform/ios/platform/ios/vendor:SMCalloutView",
],
)
# Common headers between objc and objcpp libraries.
objc_library(
name = "objc-headers",
srcs = glob([
"platform/darwin/src/*.h",
"platform/ios/src/*.h",
]),
includes = [
"platform/darwin/src",
"platform/ios/src",
],
sdk_frameworks = [
"CoreGraphics",
"CoreLocation",
"QuartzCore",
],
deps = [
"//platform/darwin:darwin-objc",
"//platform/darwin:darwin-objcpp",
],
)
objc_library(
name = "sdk-headers",
hdrs = ["platform/ios/src/Mapbox.h"] + _PUBLIC_HEADERS,
)
objc_library(
name = "iosapp",
defines = ["GLES_SILENCE_DEPRECATION"],
srcs = [
"platform/darwin/app/LimeGreenStyleLayer.h",
"platform/darwin/app/LimeGreenStyleLayer.m",
"platform/ios/app/MBXAnnotationView.m",
"platform/ios/app/MBXAppDelegate.m",
"platform/ios/app/MBXCustomCalloutView.h",
"platform/ios/app/MBXCustomCalloutView.m",
"platform/ios/app/MBXCustomLocationViewController.m",
"platform/ios/app/MBXEmbeddedMapViewController.m",
"platform/ios/app/MBXFrameTimeGraphView.m",
"platform/ios/app/MBXOfflinePacksTableViewController.m",
"platform/ios/app/MBXOrnamentsViewController.m",
"platform/ios/app/MBXSnapshotsViewController.m",
"platform/ios/app/MBXState.m",
"platform/ios/app/MBXStateManager.m",
"platform/ios/app/MBXUserLocationAnnotationView.m",
"platform/ios/app/MBXViewController.m",
"platform/ios/app/main.m",
],
hdrs = [
"platform/ios/app/MBXAnnotationView.h",
"platform/ios/app/MBXAppDelegate.h",
"platform/ios/app/MBXCustomLocationViewController.h",
"platform/ios/app/MBXEmbeddedMapViewController.h",
"platform/ios/app/MBXFrameTimeGraphView.h",
"platform/ios/app/MBXOfflinePacksTableViewController.h",
"platform/ios/app/MBXOrnamentsViewController.h",
"platform/ios/app/MBXSnapshotsViewController.h",
"platform/ios/app/MBXState.h",
"platform/ios/app/MBXStateManager.h",
"platform/ios/app/MBXUserLocationAnnotationView.h",
"platform/ios/app/MBXViewController.h",
"platform/ios/app/MLNMapView_Experimental.h",
],
data = glob([
"platform/ios/app/Assets.xcassets/**",
]),
includes = [
"platform/darwin/app",
"platform/darwin/src",
"platform/ios/src",
],
sdk_frameworks = [
"GLKit", # needed for LimeGreenStyleLayer
],
deps = [
"sdk-headers",
],
visibility = ["//visibility:public"],
)
_IOS_APPLICATION_RESOURCES = [
@@ -394,7 +161,7 @@ _IOS_APPLICATION_RESOURCES = [
ios_application(
name = "App",
bundle_id = "org.maplibre.app",
bundle_id = "{}.maplibre.app".format(BUNDLE_ID_PREFIX),
families = [
"iphone",
"ipad",
@@ -404,7 +171,6 @@ ios_application(
provisioning_profile = "xcode_profile",
resources = _IOS_APPLICATION_RESOURCES,
visibility = ["//visibility:public"],
provisioning_profile = ":xcode_profile",
deps = [
"//platform:iosapp",
],
@@ -425,7 +191,6 @@ ios_application(
provisioning_profile = ":xcode_profile",
resources = _IOS_APPLICATION_RESOURCES,
visibility = ["//visibility:public"],
provisioning_profile = ":xcode_profile",
deps = [
"//platform:iosapp",
],
@@ -472,12 +237,6 @@ xcodeproj(
minimum_xcode_version = "14",
project_name = "MapLibre",
tags = ["manual"],
bazel_env = {"PATH": "/bin:/usr/bin:/usr/local/bin:/opt/homebrew/bin"},
default_xcode_configuration = "Debug",
xcode_configurations = {
"Debug": {"//command_line_option:compilation_mode": "dbg"},
"Release": {"//command_line_option:compilation_mode": "opt"}
},
top_level_targets = [
top_level_target(
"App",
@@ -514,6 +273,13 @@ xcodeproj(
"device",
],
),
top_level_target(
"//platform/ios/test/core:CppUnitTests",
target_environments = [
"simulator",
"device",
],
),
],
xcode_configurations = {
"Debug": {"//command_line_option:compilation_mode": "dbg"},

View File

@@ -22,35 +22,6 @@ const args = (() => {
return parser.parse_args();
})();
let writeGenerated;
if (args.root) {
const targetRoot = path.join(args.root, "__generated__");
if (args.root) {
if (!fs.existsSync(targetRoot)) {
fs.mkdirSync();
}
}
writeGenerated = (pathString, contents) => {
const location = path.parse(
path.relative(__dirname + "/../", path.normalize(pathString))
);
pathString = path.join(targetRoot, location.dir);
if (!fs.existsSync(pathString)) {
fs.mkdirSync(pathString, {recursive: true});
}
writeIfModified(
path.join(pathString, location.name + location.ext), contents);
}
} else {
writeGenerated = (pathString, contents) => {
writeIfModified(pathString, contents);
};
}
function parseCSSColor(str) {
const color = colorParser.parseCSSColor(str);
return [
@@ -302,16 +273,16 @@ const layers = Object.keys(spec.layer.type.values).map((type) => {
for (const layer of layers) {
const layerFileName = layer.type.replace('-', '_');
writeGenerated(`${__dirname}/../src/mbgl/style/layers/${layerFileName}_layer_properties.hpp`, propertiesHpp(layer));
writeGenerated(`${__dirname}/../src/mbgl/style/layers/${layerFileName}_layer_properties.cpp`, propertiesCpp(layer));
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.hpp`, propertiesHpp(layer), args.root);
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.cpp`, propertiesCpp(layer), args.root);
// Remove our fake property for the external interace.
if (layer.type === 'line') {
layer.paintProperties = layer.paintProperties.filter(property => property.name !== 'line-floor-width');
}
writeGenerated(`${__dirname}/../include/mbgl/style/layers/${layerFileName}_layer.hpp`, layerHpp(layer));
writeGenerated(`${__dirname}/../src/mbgl/style/layers/${layerFileName}_layer.cpp`, layerCpp(layer));
writeIfModified(`include/mbgl/style/layers/${layerFileName}_layer.hpp`, layerHpp(layer), args.root);
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer.cpp`, layerCpp(layer), args.root);
}
// Light
@@ -327,7 +298,7 @@ const lightProperties = Object.keys(spec[`light`]).reduce((memo, name) => {
// to get a deterministic order.
lightProperties.sort((a, b) => collator.compare(a.name, b.name));
const lightHpp = ejs.compile(fs.readFileSync(`${__dirname}/../include/mbgl/style/light.hpp.ejs`, 'utf8'), {strict: true});
const lightCpp = ejs.compile(fs.readFileSync(`${__dirname}/../src/mbgl/style/light.cpp.ejs`, 'utf8'), {strict: true});
writeGenerated(`${__dirname}/../include/mbgl/style/light.hpp`, lightHpp({properties: lightProperties}));
writeGenerated(`${__dirname}/../src/mbgl/style/light.cpp`, lightCpp({properties: lightProperties}));
const lightHpp = ejs.compile(fs.readFileSync(`include/mbgl/style/light.hpp.ejs`, 'utf8'), {strict: true});
const lightCpp = ejs.compile(fs.readFileSync(`src/mbgl/style/light.cpp.ejs`, 'utf8'), {strict: true});
writeIfModified(`include/mbgl/style/light.hpp`, lightHpp({properties: lightProperties}), args.root);
writeIfModified(`src/mbgl/style/light.cpp`, lightCpp({properties: lightProperties}), args.root);

View File

@@ -32,7 +32,6 @@ layout (std140) uniform LineSDFInterpolationUBO {
lowp float u_offset_t;
lowp float u_width_t;
lowp float u_floorwidth_t;
highp float pad2;
};

View File

@@ -46,7 +46,6 @@ layout (std140) uniform LineSDFInterpolationUBO {
lowp float u_offset_t;
lowp float u_width_t;
lowp float u_floorwidth_t;
highp float pad2;
};

View File

@@ -221,13 +221,11 @@ const args = (() => {
// Generate shader source headers
const shaderRoot = "shaders/";
const outputRoot = path.join((args.root ? args.root : ""), "include/mbgl/shaders");
let generatedHeaders = [];
let shaderNames = [];
const targetRoot = path.join(args.root, "__generated__");
if (!fs.existsSync(targetRoot)) {
fs.mkdirSync();
}
console.log("Writing shaders to ", outputRoot);
JSON.parse(fs.readFileSync(path.join(shaderRoot, "manifest.json")))
.filter(it => typeof it == "object")
@@ -245,7 +243,7 @@ JSON.parse(fs.readFileSync(path.join(shaderRoot, "manifest.json")))
? pragmaMapConvertOnlyVertexArrays(vertexSource, pragmaMap, attribMap, "vertex")
: pragmaMapConvert(vertexSource, pragmaMap, attribMap, "vertex");
const glRoot = path.join(args.root, "__generated__/include/mbgl/shaders/gl");
const glRoot = path.join(outputRoot, "gl");
if (!fs.existsSync(glRoot)) {
fs.mkdirSync(glRoot, {recursive: true}); // Ensure target directory is available
}
@@ -275,7 +273,7 @@ struct ShaderSource<BuiltIn::${elem.name}, gfx::Backend::Type::OpenGL> {
);
// Generate the manifest
fs.writeFileSync(path.join(args.root, "__generated__/include/mbgl/shaders/shader_manifest.hpp"),
fs.writeFileSync(path.join(outputRoot, "shader_manifest.hpp"),
`${generatedHeader}
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -286,7 +284,7 @@ ${generatedHeaders.join('\n')}
`);
// Generate shader_source.hpp
fs.writeFileSync(path.join(args.root, "__generated__/include/mbgl/shaders/shader_source.hpp"),
fs.writeFileSync(path.join(outputRoot, "shader_source.hpp"),
`${generatedHeader}
#pragma once
#include <mbgl/gfx/backend.hpp>