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

feat: add support of Metal renderer on macOS. #2461

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crupest
Copy link
Contributor

@crupest crupest commented Apr 3, 2024

Add Metal renderer on macOS.

Currently this is a very naive implementation. I created this pr when the window at least shows things. I'm very unfamiliar with Metal development. So if you have any advice, I will extremely appreciate it.

@crupest crupest marked this pull request as draft April 3, 2024 13:22
Cargo.toml Outdated
[target.'cfg(target_os = "macos")'.dependencies]
icrate = { version = "0.0.4", features = [ "apple", "Foundation", "Foundation_NSThread", "AppKit", "AppKit_NSColor", "AppKit_NSEvent", "AppKit_NSView", "AppKit_NSWindow", "AppKit_NSViewController", "AppKit_NSMenu", "AppKit_NSMenuItem", "AppKit_NSOpenPanel", "AppKit_NSScreen", "Foundation_NSArray" ] }
objc2 = "0.4.1"
metal = "0.27.0"
skia-safe = { version = "0.68.0", features = ["metal", "gl", "textlayout"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It think you should be able to use the standard gl, textlayout, feature here. We don't use anything from the metal and gl features, even if the rendering is done through that.

There's no metal, gl, textlayout binary combination as far as I can see https://github.com/rust-skia/skia-binaries/releases, so it would slow down the compilation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though there is no metal, gl, textlayout combination there, this is exactly what we want. Just like on Windows, there are two renderer, OpenGL and D3D. There are also two renderer, OpenGL and Metal on macOS. Without either one, it does not compile.

I don't know why there is no such combination. Maybe due to OpenGL is obsolete on macOS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was probably wrong, and it's indeed needed. I remembered wrong how it was done on Window.

I guess we have to ask for binaries from skia-safe then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's OK.

The compilation does not fail. It will build skia from scratch and use it. Though I never experienced using a pre-compiled binary on my machine. It always build from scratch.

Copy link

github-actions bot commented May 3, 2024

Test Results

  6 files  ±0    6 suites  ±0   15s ⏱️ -1s
110 tests ±0  110 ✅ ±0  0 💤 ±0  0 ❌ ±0 
644 runs  ±0  644 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 29c4cdd. ± Comparison against base commit 818ff73.

♻️ This comment has been updated with latest results.

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

Successfully merging this pull request may close these issues.

None yet

2 participants