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

native/macos: Fixes setNeedsDisplay call on arm macs #476

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

birhburh
Copy link
Contributor

Possible fix for: #470 (comment)

If I had a nickel for every time I needed to use setNeedsDisplay hack, I'd have two nickels. Which isn't a lot, but it's weird that it happened twice

@brettchalupa, can you please recheck now
And with metal also, please, just to be sure (cargo run --example quad metal)

@not-fl3 not-fl3 merged commit 43faf97 into not-fl3:master Aug 12, 2024
10 checks passed
// YES to setNeedsDisplay - send a no argument message
// https://stackoverflow.com/questions/6120614/passing-primitives-through-performselectoronmainthread
// It seems that the same thing applies to [NSTimer timerWithTimeInterval:...]
extern "C" fn set_needs_display_hack(this: &Object, _: Sel) {
Copy link
Owner

Choose a reason for hiding this comment

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

shame on you, apple, I wish we did not need to do this :(

@brettchalupa
Copy link

@birhburh confirmed that cargo run --release --example triangle runs on macOS on Silicon and does not seg fault. Also CPU usage is much lower, at about 8% with that example.

I confirmed cargo run --example quad metal runs as well and uses lower CPU usage.

Nice! 🙌

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.

3 participants