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

Metal support in iOS #19

Closed
rbrundritt opened this issue Feb 16, 2021 · 12 comments
Closed

Metal support in iOS #19

rbrundritt opened this issue Feb 16, 2021 · 12 comments

Comments

@rbrundritt
Copy link

OpenGL ES is deprecated in iOS 12, in favor of Metal which is pretty significant. Copying over issue from Mapbox GL native: mapbox/mapbox-gl-native#12061

@systemed
Copy link

MetalANGLE is a translation layer that could potentially be used to map OpenGL ES calls to Metal: https://github.com/kakashidinho/metalangle

@sulewicz
Copy link
Collaborator

sulewicz commented Mar 2, 2021

I tried out MetalANGLE and after a couple of tweaks it works well. I will prepare a PR once I cleanup the code. Here are the benchmark results of the Debug build (both MapLibre and MetalANGLE) running on Simulator. We should be able to hit 60 fps with a Release build:

2021-03-01 12:28:56.056928-0800 Bench GL[42138:8510478] Benchmark completed.
2021-03-01 12:28:56.056990-0800 Bench GL[42138:8510478] Result:
2021-03-01 12:28:56.057061-0800 Bench GL[42138:8510478] | paris | 51.8 fps |
2021-03-01 12:28:56.057130-0800 Bench GL[42138:8510478] | paris2 | 42.4 fps |
2021-03-01 12:28:56.057197-0800 Bench GL[42138:8510478] | alps | 59.0 fps |
2021-03-01 12:28:56.057264-0800 Bench GL[42138:8510478] | us east | 57.1 fps |
2021-03-01 12:28:56.057340-0800 Bench GL[42138:8510478] | greater la | 54.0 fps |
2021-03-01 12:28:56.057402-0800 Bench GL[42138:8510478] | sf | 41.4 fps |
2021-03-01 12:28:56.057497-0800 Bench GL[42138:8510478] | oakland | 52.3 fps |
2021-03-01 12:28:56.057569-0800 Bench GL[42138:8510478] | germany | 59.8 fps |
2021-03-01 12:28:56.057677-0800 Bench GL[42138:8510478] Total FPS: 417.8
2021-03-01 12:28:56.057816-0800 Bench GL[42138:8510478] Average FPS: 52.2

@rotoglup
Copy link

FWIW for others interested in the matter, an experimental metal-support branch has landed through PR #40.

@roblabs
Copy link
Collaborator

roblabs commented Mar 31, 2021

Test Results of Archive & upload to App Store Connect (TestFlight) of the MapLibre test app iosapp with MapLibre + MetalANGLE SDKs

Results Summary — the MetalANGLE SDK adds approximately 6.7 MB to the install size for iOS & iPadOS variants.

Key

  • 🗺 - Size of iosapp with MapLibre SDK only
  • 🗺+🎸 - Size with MapLibre SDK + MetalANGLE SDK
  • The Universal Device Type has data for a basic MapKit app based on Swift UI. This is intended to demonstrate the smallest possible app that can render a MapKit based map.

Methodology

  • Upload a build to App Store Connect with app thinning.

  • App Store Connect reports App Store File Sizes in KB.

  • app thinning "creates variants of your app for different devices and operating system versions. You can view the size of the variants directly in App Store Connect."1

  • Approved apps for the App Store are "encrypted with DRM and recompressed. The added encryption and DRM affects the ability to compress your binary, and as a result you may see a larger App Store file size for your binary than the binary you uploaded in App Store Connect."1

  • 1 - Definitions such as Download and Install size - https://help.apple.com/app-store-connect/#/dev3b56ce97c?sub=dev7379ba2ed

DEVICE TYPE DOWNLOAD SIZE INSTALL SIZE
This is the compressed size of the app downloaded over the air. This is the amount of disk space the app will take up on the customer's device. The install size also appears on your app’s product page in the Information section.
Universal 1706 KB MapKit
11742 KB 🗺
23240 KB 🗺+ 🎸
---
🎸 adds an additional 11498 KB
1924 KB MapKit
20146 KB 🗺
32855 KB 🗺+ 🎸
---
🎸 adds an additional 12709 KB
iPad (6th generation)  6221 KB  🗺
12380 KB 🗺+ 🎸
---
🎸 adds an additional 6159 KB
 14105 KB  🗺
20915 KB 🗺+ 🎸
---
🎸 adds an additional 6810 KB
iPad Pro (11‑inch)  6220 KB  🗺
12379 KB 🗺+ 🎸
---
🎸 adds an additional 6159 KB
 14100 KB  🗺
20911 KB 🗺+ 🎸
---
🎸 adds an additional 6811 KB
iPad Pro (12.9‑inch) (4th generation)  2834 KB  🗺
5042 KB 🗺+ 🎸
---
🎸 adds an additional 2208 KB
 14007 KB  🗺
20708 KB 🗺+ 🎸
---
🎸 adds an additional 6701 KB
iPhone 5S  6216 KB  🗺
12375 KB 🗺+ 🎸
---
🎸 adds an additional 6159 KB
 14096 KB  🗺
20907 KB 🗺+ 🎸
---
🎸 adds an additional 6811 KB
iPhone 7 Plus  6225 KB  🗺
12385 KB 🗺+ 🎸
---
🎸 adds an additional 6160 KB
 14105 KB  🗺
20915 KB 🗺+ 🎸
---
🎸 adds an additional 6810 KB
iPhone 11 Pro Max  2839 KB  🗺
5047 KB 🗺+ 🎸
---
🎸 adds an additional 2208 KB
 14011 KB  🗺
20712 KB 🗺+ 🎸
---
🎸 adds an additional 6701 KB
iPhone SE (2nd generation)  2830 KB  🗺
5038 KB 🗺+ 🎸
---
🎸 adds an additional 2208 KB
 14003 KB  🗺
20704 KB 🗺+ 🎸
---
🎸 adds an additional 6701 KB
iPhone 12 mini  2839 KB  🗺
5047 KB 🗺+ 🎸
---
🎸 adds an additional 2208 KB
 14011 KB  🗺
20712 KB 🗺+ 🎸
---
🎸 adds an additional 6701 KB
iPhone 12 Pro Max  2839 KB  🗺
5047 KB 🗺+ 🎸
---
🎸 adds an additional 2208 KB
 14011 KB  🗺
20712 KB 🗺+ 🎸
---
🎸 adds an additional 6701 KB
iPod touch (6th generation)  6216 KB  🗺
12375 KB 🗺+ 🎸
---
🎸 adds an additional 6159 KB
 14096 KB  🗺
20907 KB 🗺+ 🎸
---
🎸 adds an additional 6811 KB

@roblabs roblabs added bug Something isn't working metal and removed bug Something isn't working labels Apr 21, 2021
@hactar
Copy link
Collaborator

hactar commented Aug 25, 2021

Thanks for working on this! Any progress since the experimental release? While I don't think we can help codewise, Bikemap is now a maplibre sponsor - symbolically for now until we can switch (waiting for metal)...

@sulewicz
Copy link
Collaborator

Hello! We still need to setup Metal-supported CI and solve an issue with laggy annotation views. Have you had a chance to try out the experimental build? Are there any other problems you've experienced with it?

@hactar
Copy link
Collaborator

hactar commented Jan 16, 2022

So I've finally had a chance to try out the the experimental builds. They work well: we can finally work on M1 machines without enabling rosetta.

We did have the random crash here and there, especially when working with the snapshotter. Because the whole development team has now been upgraded to M1 machines (the non metal builds do not work, we have little to no choice: we need to use the prerelease version and hope this will become the general pipe line soon. There is a new version of metalangle available, and you've patched a few things in the non metal builds. Would be great if that could all be brought together.

I did take a stab at trying to help with this, but quickly lost my way. Most documentation, especially "develop" documentation, still talks about Mapbox and appears to not the the way to build things in metal mode.

@hakkurishian
Copy link

Is this topic still being actively pursued?

@wipfli
Copy link
Contributor

wipfli commented Jun 3, 2022

I think there is a large interest in Metal support, especially because Apple might drop OpenGL at some point. This will be an interesting challenge and we will need code contributors and also reviewers. @hakkurishian would you be interested in joining this effort?

@wipfli
Copy link
Contributor

wipfli commented Jun 9, 2022

#202

@louwers
Copy link
Collaborator

louwers commented Aug 7, 2023

A rendering backend that uses Metal-cpp directly is under development.

Progress can be tracked here: https://github.com/orgs/maplibre/projects/8

@louwers
Copy link
Collaborator

louwers commented Sep 21, 2023

We now have a pre-release out with Metal support.

Testers needed. Please see: #1609

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants