SaschaWillems / Vulkan

C++ examples for the Vulkan graphics API
MIT License
10.18k stars 2.02k forks source link

Add updated iOS App support to the Vulkan examples #1119

Closed SRSaunders closed 3 months ago

SRSaunders commented 4 months ago

This PR depends on and includes #1117 due to those dependencies - only the final commits here are new. However, I am submitting this as a separate PR since I am not sure if you want to include iOS in your project. I would be happy to provide support from time-to-time for new updates if you need it. I would be interested in @billhollings reaction and if he would like this added to your repository, or if he has other plans. Most of the original code was his, and credits/copyright remain in place but perhaps dates should be updated.

Similar to before, it is an Xcode project contained within a separate sub-folder (but named apple this time) that depends on the base project. It is like the previous xcode sub-folder, but with documentation and functionality emphasis on iOS and the iOS Simulator. macOS standalone app support is also present but not emphasized. Most users should use the base cmake project in the main folder for macOS.

Details are:

  1. Updated to use VK_USE_PLATFORM_METAL_EXT by default vs. deprecated VK_USE_PLATFORM_IOS_MVK
  2. Updated to use MoltenVK.xcframework from the Vulkan SDK (requires SDK 1.3.275.0 and Xcode 14 or later).
  3. Added support for single and multi-touch gestures on iOS and the iOS Simulator, allowing select and rotation of the scene, plus translation and zoom. Virtual keyboard support remains for imgui overlay toggle and animation pausing.
  4. Updated example.h file with categories and comments on which examples currently work and don't work on iOS.
  5. Updated to work with your current main project baseline.
  6. Updated docs.

Let me know if you are interested in this and if so, I will do my best to help out. If not, then no worries. I realize that automated CI support is not implemented at this time, but perhaps could be added.

Here is a pic of the bloom example running on the iOS simulator... Screenshot 2024-04-21 at 1 26 16 PM

SaschaWillems commented 4 months ago

Thank you very much for your PR. This is very much appreciated. I don't own any apple devices to test this on, so all I can do is a code review.

I will take a look at this, but it may take a few weeks.

SRSaunders commented 4 months ago

Again thanks for agreeing to look at this. Only commits https://github.com/SaschaWillems/Vulkan/pull/1119/commits/31f98f9ec5136d3d9bf0e832f69ff1eecbe37a5a and later are different from the other PR.

Given your comments above about testing on Apple devices, I have gone ahead and added CI support for iOS so you can at least be assured of build sanity.

SRSaunders commented 4 months ago

Fixed merge conflicts.

Thanks for catching my redundant code for getting rayTracingPipelineProperties. I originally missed that common code in VulkanRayTracingSample.

Also, it seems that you don't want the benchmarking script. Note it is present in this PR too, so please remove if desired.

SaschaWillems commented 3 months ago

Thank you very much for the confirmation. Merging this now :)