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

fix: properly set viewports and render targets for Apple Vision Pro #3325

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

okwasniewski
Copy link
Contributor

@okwasniewski okwasniewski commented Jul 15, 2024

This PR partially fixes issues with bgfx rendering on Apple Vision Pro devices. It aims to fix issues described in this Tweet: https://x.com/o_kwasniewski/status/1811313113527992391

Here is the outline of what this PR is doing:

  • Correctly calculate and set the viewports for each eye
  • Retrieve configuration layer_renderer
  • Set Vertex Amplification to make both eyes see the content. (MRT - multiple render targets)
  • Fixes issues with frame rendering function calls (now it's following Apple docs)
  • Properly sets fields on renderPassDescriptor
  • Warns users that BFGX does not support .dedicated layout at this point

@okwasniewski okwasniewski changed the title fix: properly set viewports and render targets fix: properly set viewports and render targets for Apple Vision Pro Jul 15, 2024
src/renderer_mtl.mm Outdated Show resolved Hide resolved
src/renderer_mtl.mm Outdated Show resolved Hide resolved
@bkaradzic
Copy link
Owner

bkaradzic commented Jul 15, 2024

Also number of eyes is not arbitrary, so you don't have to use dynamic array type of containers for viewports at all... Consider what's maximum number of eyes you will ever have on VisionOS, and then create something more appropriate.

@okwasniewski
Copy link
Contributor Author

Hey @bkaradzic thanks for reviewing, I removed STL references and allocated a static C-like array for the viewports.

@okwasniewski okwasniewski force-pushed the fix/multi-target-rendering branch 2 times, most recently from ba7a8ff to 93707dd Compare July 16, 2024 11:13
src/renderer_mtl.mm Outdated Show resolved Hide resolved
@okwasniewski
Copy link
Contributor Author

Hey @bkaradzic, anything you would like to see changed in this PR?

Just so you know, we are moving forward with the integration (currently by cherry-picking the changes) and we have made some progress. I'm attaching a video of Babylon Native running on the device, we still need to figure out 6DOF but it's on the Babylon side.

ScreenRecording.July.19.2024.mov

@bkaradzic bkaradzic merged commit b4df15f into bkaradzic:master Jul 25, 2024
11 checks passed
okwasniewski added a commit to okwasniewski/bgfx that referenced this pull request Aug 1, 2024
okwasniewski added a commit to okwasniewski/bgfx that referenced this pull request Aug 1, 2024
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