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 (simulated) visionOS #3883

Merged
merged 3 commits into from
Jun 23, 2023
Merged

Conversation

jinleili
Copy link
Contributor

@jinleili jinleili commented Jun 22, 2023

Checklist

  • Run cargo clippy.
  • Run cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Description
Apple announced the new visionOS at WWDC 2023. Now, visionOS 1.0 can be run on Xcode 15 Beta 2 through the simulator. This pull request addresses a bug that occurs when running wgpu on visionOS.

The MSL version was determined based on the iOS and macOS versions. The following error occurs when running the boids example:

Using Apple xrOS simulator GPU (Metal)
[2023-06-22T07:41:49Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default
thread '<unnamed>' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_compute_pipeline
      note: label = `Compute pipeline`
    Internal error: MSL: UnsupportedAddressSpace(Storage { access: StorageAccess(LOAD) })

', /Users/lijinlei/Rust/forks/wgpu/wgpu/src/backend/direct.rs:3023:5

In addition, the family_check field was also set based on the iOS and macOS versions, which causes feature detection to fail on visionOS. The following error occurs when running the shadow example:

-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5780: failed assertion `Draw Errors Validation

Vertex Function(vs_bake): the offset into the buffer u_entity that is bound at buffer index 1 must be a multiple of 256 but was set to 128.
'

Testing
Tested via https://github.com/jinleili/wgpu-in-app

720p.mp4

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

I can't yet find any info on visionOS in the Metal Feature Set Tables. I feel like it might be too early for this but if people want to play with it I'm not opposed to it.

wgpu-hal/src/metal/adapter.rs Show resolved Hide resolved
@jinleili jinleili changed the title metal: support visionOS metal: support (simulated) visionOS Jun 23, 2023
@cwfitzgerald cwfitzgerald merged commit 757245c into gfx-rs:trunk Jun 23, 2023
@jinleili jinleili deleted the visionOS branch July 7, 2023 20:55
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