-
Notifications
You must be signed in to change notification settings - Fork 652
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
iOS runtime fixes #1173
base: main
Are you sure you want to change the base?
iOS runtime fixes #1173
Conversation
…liminate redundancy
…ApiVulkanSample::update()
…ed() vertex offset limitations
…y in oit* samples
…tions, pipeline_barriers, subpasses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't tell anything about the iOS Simulator stuff.
But it seems, you have three identical code sequences introduced in layout_transition.cpp, pipeline_barriers.cpp, and subpasses.cpp. Maybe introduce a little helper function, instead?
@@ -653,7 +668,13 @@ void HPPGui::draw(vk::CommandBuffer command_buffer) const | |||
command_buffer.drawIndexed(cmd->ElemCount, 1, index_offset, vertex_offset, 0); | |||
index_offset += cmd->ElemCount; | |||
} | |||
#if defined(PLATFORM__MACOS) && TARGET_OS_IOS && TARGET_OS_SIMULATOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit torn on "polluting" code with a special case as the iOS simulator. Can this be solved in a more elegant way? I wouldn't mind if we'd simply disable the UI on the iOS simulator instead of adding specific code for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I debated this myself, and actually tried the UI disable route initially. However, I didn't like the experience, especially in batch mode where you really can't tell what is going on as the sample runs through its various configurations. And also in the near future I would to add gesture and key input handling for iOS and without the UI present on the Simulator that would be completely inaccessible.
The reason I like the iOS Simulator is that it is easy to run and does not require an Apple Development Certificate nor a unqiue bundle identifier for iOS. I figured this would make your project easily accessible for iOS testing without adding overhead for potential users. In addition, the Simulator allows me to try different devices that I don't own (e.g. larger screen and various generation iOS devices).
If you don't like the #ifdef special case handling, the change that I made is completely generic and could be applied to all platforms, i.e. simply don't use vertex_offset > 0 and use my rebinding code for all platforms. Not sure if you would like that but it would make the code generic. Please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe if we combine them into a new macro that's APPLE specific. Say SAMPLES_PLATFORM_APPLE or similar. I think the path of having macros is fine but there are other platforms in the Apple ecosystem that we haven't added support for yet.
…lkanSample::update()
…ate in a separate PR
…transitions, pipeline_barriers, subpasses
Description
This PR fixes multiple runtime issues for iOS physical device and iOS Simulator targets:
main_loop_frame()
and eliminates redundancy withmain_loop()
. Moved window close logic frommain_loop()
tomain_loop_frame()
so iOS can handle this condition properly. This does not change behaviour for other platforms sincemain_loop()
callsmain_loop_frame()
.render()
within[HPP]ApiVulkanSample::update()
. This is primarily defensive code but the issue was visible before improving error detection inmain_loop_frame()
.main_loop_frame()
return code handling within iOSrenderLoop()
- this was previously missing. Also adds exit handling when an error is encountered or batch mode is complete. The latter is unconventional for iOS, but is justified here since this is an Xcode-controlled developer application.[HPP]Gui::draw()
to work with iOS Simulator with itsvkCmdDrawIndexed()
vertex offset limitations. The iOS Simulator does not support vertex offets > 0, so I made a modification that rebinds the vertex buffer with an offset when running on the iOS Simulator. Functionality is unchanged when running on real iOS targets or other platforms.General: Use Vulkan API 1.0 support funcs for Vulkan API 1.0 sample host_image_copy. The sample originally usedMoved to a separate PR.vkGetPhysicalDeviceFormatProperties2()
(API 1.1) but should usevkGetPhysicalDeviceFormatProperties2KHR()
. This issue shows up when using MoltenVK which is more sensitive to the Vulkan API version than the Vulkan loader.iOS Simulator only: Disable MoltenVK's Metal Argument Buffers on the iOS Simulator for samples: layout_transitions, pipeline_barriers, subpasses. Otherwise the samples can display blank screens on the iOS Simulator.Reverted for now until issue resolved in MoltenVK project.Tested on iOS 17 with an iPhone 15, on the iOS Simulator, and macOS Ventura.
General Checklist:
Please ensure the following points are checked:
Note: The Samples CI runs a number of checks including:
If this PR contains framework changes:
batch
command line argument to make sure all samples still work properlySample Checklist
If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist: