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

iOS example #218

Merged
merged 6 commits into from
Mar 13, 2020
Merged

iOS example #218

merged 6 commits into from
Mar 13, 2020

Conversation

bschwind
Copy link
Contributor

@bschwind bschwind commented Sep 30, 2019

From #214

This is essentially the triangle example, with some steps in a README describing how to build and run the example via Xcode.

I'm currently not pleased with the cargo setup I have, I needed to make the example its own project because I was building a library. I thought you could build examples as static libraries, but I couldn't get it to work. If someone could help, that would potentially simplify a lot.

Update: Got it working via the normal cargo example system, not sure why I had trouble before.

There are also some nastier issues when building, having to do with shaderc-sys and CMake. I had to manually edit a CMakeCache.txt file in order to make the build work it's described in the README. I need to investigate more on that.

The example runs and displays a triangle, however it eventually crashes with an error:

2019-10-01 01:21:24.865061+0900 ios-triangle[3636:293430] Metal GPU Frame Capture Enabled
2019-10-01 01:21:24.865982+0900 ios-triangle[3636:293430] Metal API Validation Enabled
thread '<unnamed>' panicked at 'winit iOS bug, file an issue: `EventHandler` unexpectedly started polling', /Users/brian/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.20.0-alpha3/src/platform_impl/ios/app_state.rs:268:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
libc++abi.dylib: terminating with uncaught foreign exception

This is an issue with winit, perhaps it's not visible in the most recent version, I haven't tested enough yet.

I ran this with XCode 10 + iOS 12 on an iPhone SE at first, and it was crashing due to some metal command buffer calls.

Today I ran it with XCode 11 + iOS 13 and it eventually reaches the winit crash I described above.

@codecov-io
Copy link

codecov-io commented Oct 6, 2019

Codecov Report

Merging #218 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #218   +/-   ##
=======================================
  Coverage   87.57%   87.57%           
=======================================
  Files           6        6           
  Lines         169      169           
=======================================
  Hits          148      148           
  Misses         21       21

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6359807...ab86dc9. Read the comment docs.

@bschwind
Copy link
Contributor Author

bschwind commented Oct 6, 2019

Update: I rebased on the latest master, removed the exit after 5 seconds which I somehow hadn't noticed, and ran it again on iOS 13.

It works until I rotate the screen to landscape, then back to portrait. Everything freezes and I get:

2019-10-06 19:37:08.305133+0900 ios-triangle[12625:1316008] Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)
2019-10-06 19:37:08.305534+0900 ios-triangle[12625:1316008] Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)
2019-10-06 19:37:08.305937+0900 ios-triangle[12625:1316008] Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)
2019-10-06 19:37:08.306073+0900 ios-triangle[12625:1316008] Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)
2019-10-06 19:37:08.306226+0900 ios-triangle[12625:1316008] Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)
2019-10-06 19:37:08.306333+0900 ios-triangle[12625:1316008] Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)

Screenshot of it working, looks kinda crap. Maybe there's a DPI issue with winit or something.

IMG_8129

@bschwind bschwind changed the title [wip] iOS example iOS example Oct 6, 2019
Copy link

@simlay simlay left a comment

Choose a reason for hiding this comment

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

This is pretty cool. I kinda think you should put some of the steps you've got in the readme in a makefile and then put those as rules in the CI. The CMakeCache issue really is grossest of the setup steps.

[https://github.com/paritytech/rust-snappy/pull/10/files](https://github.com/paritytech/rust-snappy/pull/10/files)
[https://stackoverflow.com/questions/52879026/cmake-cross-compile-on-macos-adds-macos-sdk-to-isysroot-in-flags-make/52879604#52879604](https://stackoverflow.com/questions/52879026/cmake-cross-compile-on-macos-adds-macos-sdk-to-isysroot-in-flags-make/52879604#52879604)

* Open Xcode
Copy link

Choose a reason for hiding this comment

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

I've been adding examples with the Xcode project in them as seen in rust-windowing/glutin#1233. I admit that it's a bit annoying to setup but you can also make it run in CI that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll have to take a look at that, I haven't worked on this in quite awhile so I need to refresh my memory.

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.

4 participants