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

Fixes to iOS render loop and HUD overlay. #1120

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

billhollings
Copy link
Collaborator

@billhollings billhollings commented Jul 31, 2024

  • Refactor Platform::main_loop_frame() and main_loop(),
    to reduce fragility, and avoid unnecessary code duplication.

  • Avoid initial app_requested() test in main_loop_frame(),
    as it was causing looping to stop after one frame.

  • Since main_loop() is not a virtual function, remove
    declaration comment indicating it can be overridden.

  • Set iOS view to have a black background, to ensure
    transparency in HUD overlay displays in full on device.

  • Fix rendering scaling in IosWindow::get_dpi_factor().
    Previous value was causing HUD overlay to render magnitudes too large.

  • Add macOS files to .gitignore.

I created this from a branch on this repo instead of a separate fork, because I was not expecting to need to make a fix.

Fixes #1121
Fixes #1131

General Checklist:

Please ensure the following points are checked:

  • My code follows the coding style
  • I have reviewed file licenses
  • I have commented any added functions (in line with Doxygen)
  • I have commented any code that could be hard to understand
  • My changes do not add any new compiler warnings
  • My changes do not add any new validation layer errors or warnings
  • I have used existing framework/helper functions where possible
  • My changes do not add any regressions
  • I have tested every sample to ensure everything runs correctly
  • This PR describes the scope and expected impact of the changes I am making

Note: The Samples CI runs a number of checks including:

  • I have updated the header Copyright to reflect the current year (CI build will fail if Copyright is out of date)
  • My changes build on Windows, Linux, macOS and Android. Otherwise I have documented any exceptions

If this PR contains framework changes:

  • I did a full batch run using the batch command line argument to make sure all samples still work properly

Sample Checklist

If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist:

  • I have tested the sample on at least one compliant Vulkan implementation
  • If the sample is vendor-specific, I have tagged it appropriately
  • I have stated on what implementation the sample has been tested so that others can test on different implementations and platforms
  • Any dependent assets have been merged and published in downstream modules
  • For new samples, I have added a paragraph with a summary to the appropriate chapter in the readme of the folder that the sample belongs to e.g. api samples readme
  • For new samples, I have added a tutorial README.md file to guide users through what they need to know to implement code using this feature. For example, see conditional_rendering
  • For new samples, I have added a link to the Antora navigation so that the sample will be listed at the Vulkan documentation site

framework/platform/platform.h Outdated Show resolved Hide resolved
framework/platform/ios/ios_platform.h Outdated Show resolved Hide resolved
@asuessenbach
Copy link
Contributor

You should at least resolve the failing Quality Check.

@billhollings billhollings force-pushed the fix-ios-mainloop-stall branch 5 times, most recently from 40ea4c8 to 57d03b0 Compare August 19, 2024 22:13
@billhollings
Copy link
Collaborator Author

You should at least resolve the failing Quality Check.

If tried many times.

  1. For some reason, clang-format works slightly differently on macOS than on other platforms, so running ./scripts/clang_format.py main ends up changing more than expected, and breaks the CI test here.
  2. The CI error messages are incomprehensible to me, so I'm not able to decipher what it's complaining about, in order to simply fix it manually.

@gpx1000
Copy link
Collaborator

gpx1000 commented Aug 19, 2024

https://github.com/KhronosGroup/Vulkan-Samples/actions/runs/10461719961?pr=1120

If you scroll to the bottom you can grab the diff that can be directly run and hopefully fix the issue.

@asuessenbach
Copy link
Contributor

For some reason, clang-format works slightly differently on macOS than on other platforms

Indeed, it should remove white spaces at the end of a line, and it should replace spaces with tabs.
This patch shows the difference I would get when running clang-format: 0001-formatting.patch

@billhollings billhollings force-pushed the fix-ios-mainloop-stall branch 2 times, most recently from 8cfcdc6 to 0a75d06 Compare August 21, 2024 22:16
@billhollings billhollings changed the title Fix regression that stopped render loop on iOS, and consolidate main_loop() code. Fixes to iOS render loop and HUD overlay. Aug 21, 2024
@billhollings
Copy link
Collaborator Author

billhollings commented Aug 21, 2024

@gpx1000 @asuessenbach

Thanks for the help on code formatting. I've got this formatting correctly now.

Plus I've added a couple of other iOS fixes, and updated the title and description above.

gpx1000
gpx1000 previously approved these changes Aug 21, 2024
framework/platform/ios/ios_window.mm Show resolved Hide resolved
framework/platform/platform.cpp Show resolved Hide resolved
.gitignore Show resolved Hide resolved
* Refactor Platform::main_loop_frame() and main_loop(),
  to reduce fragility, and avoid unnecessary code duplication.

* Avoid initial app_requested() test in main_loop_frame(),
  as it was causing looping to stop after one frame.

* Since main_loop() is not a virtual function, remove
  declaration comment indicating it can be overridden.

* Set iOS view to have a black background, to ensure
  transparency in HUD overlay displays in full on device.

* Fix rendering scaling in IosWindow::get_dpi_factor().
  Previous value was causing HUD overlay to render magnitudes too large.

* Add macOS files to .gitignore.
Copy link
Contributor

@asuessenbach asuessenbach left a comment

Choose a reason for hiding this comment

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

By code inspecting and running on Windows: LGTM.

Copy link
Contributor

@SRSaunders SRSaunders left a comment

Choose a reason for hiding this comment

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

LGTM. Did full batch runs for iOS + macOS and both main_loop_frame() and main_loop() worked correctly. Still need fixes for non-success return codes in iOS viewDidLoad() and renderLoop(), but these can be dealt with in a future PR.

@billhollings
Copy link
Collaborator Author

billhollings commented Aug 28, 2024

LGTM. Did full batch runs for iOS + macOS and both main_loop_frame() and main_loop() worked correctly. Still need fixes for non-success return codes in iOS viewDidLoad() and renderLoop(), but these can be dealt with in a future PR.

@SRSaunders Would you mind giving this a formal approval, so it can be merged, please?

Once the approvals are in, what is the process for merging? Do I do that? Or is there a designated person responsible for merging?

@gpx1000
Copy link
Collaborator

gpx1000 commented Aug 28, 2024

We usually ask @marty-johnson59 to handle the merging. We usually merge on 3; but Marty, I think this is safe to merge on 2.

@SRSaunders
Copy link
Contributor

@SRSaunders Would you mind giving this a formal approval, so it can be merged, please?

@billhollings I don't have approval rights for this project. I am happy to provide feedback, but I cannot mark the PR as ready for merge. As you see above, @gpx1000 has that ability.

@marty-johnson59
Copy link
Contributor

Thanks. Given this is Mac (we have limited folks who can test), I'm happy to merge w/ 2. We can revert if needed.

@marty-johnson59 marty-johnson59 merged commit 3ed806b into main Aug 28, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants