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: set max_buffer_size by the correct physical device restriction #2502

Merged
merged 2 commits into from
Feb 24, 2022
Merged

metal: set max_buffer_size by the correct physical device restriction #2502

merged 2 commits into from
Feb 24, 2022

Conversation

jinleili
Copy link
Contributor

@jinleili jinleili commented Feb 23, 2022

Connections
The wgpu matrix room mentions the 256MB restriction on macOS several times:

...
wgpu won't stop you, but mac doens't like buffers above 256mb or so
they don't like buffers over 256Mb
Consider it to be 256mb to be safe
...

Description
But starting from iOS 12 and macOS 10.14, there is a maxBufferLength property can used to query max buffer size.

In addition, since [view convertRect: toCoordinateSpace:] only affects x, y coordinates, deleting it from surface fn dimentions does not affect correctness, getting bounds and contentsScale from metalLayer is guaranteed.

Testing
Tested on these devices:

  • M1 max MacBook Pro (64G Memory), max_buffer_size = 36864 MB = 36 GB
  • Intel MacBook Pro (2018, 32G Memorry), max_buffer_size = 3072 MB = 3 GB
  • iPhone 6 Plus, max_buffer_size = 256 MB
  • iPad Mini 4, max_buffer_size = 497 MB
  • iPhone 8 plus, max_buffer_size = 747 MB
  • iPad Pro 2018, max_buffer_size = 947 MB
  • iPhone 12 Pro, max_buffer_size = 1433 MB

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Looks clean, thank you!

@kvark kvark merged commit dd4a539 into gfx-rs:master Feb 24, 2022
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.

2 participants