foxnne / aftersun

Top-down 2D RPG
MIT License
230 stars 10 forks source link

Startup freeze on macOS #17

Closed kamidev closed 7 months ago

kamidev commented 7 months ago

"zig build run" consistently displays magenta-colored window and freezes machine completely. Reboot is necessary.

Tested on M3 Max with a fresh clone of the repo and downloaded zig binaries.

➜  aftersun git:(main) git log -1 | tee
commit e6b86155bc31f6736b712b8bb85e2dc0c9e9b908
Author: foxnne <foxnne@gmail.com>
Date:   Mon Apr 8 11:16:25 2024 -0500

    settings: Play around with some of the camera settings.
➜  aftersun git:(main) sw_vers; zig cc -v
ProductName:        macOS
ProductVersion:     14.4.1
BuildVersion:       23E224
Homebrew clang version 17.0.6
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /usr/bin
➜  aftersun git:(main) which mzig
mzig: aliased to /Users/jonas/src/zig/zig-macos-aarch64-0.12.0-dev.3180+83e578a18/zig
➜  aftersun git:(main) mzig version
0.12.0-dev.3180+83e578a18
foxnne commented 7 months ago

This is the same Dawn bug as previous. I recently updated all my projects to latest mach nominated versions, which also means all of these projects can be built either with Dawn (zig build run) or sysgpu (zig build run -Duse_sysgpu=true).

Building with Dawn is going to cause these magenta screens and freezes on apple silicon, but sysgpu does not.

In the coming months, mach intends to begin ripping out Dawn as well as GLFW to attempt to replace these with sysgpu and a custom windowing library and from what Stephen has told me, he intends aftersun and pixi to be test beds for these, and would like me to adopt the changes as soon as possible, which I intend to, as soon as the needed features are there.

Just so you're aware, the reason these projects currently can build with either Dawn or sysgpu is that Dawn works fine on Windows/Linux, but sysgpu is needed for macOS. I felt this was the best way to leave things until more becomes resolved as I get crashes trying to run sysgpu on Windows right now.

So thanks for the report and I appreciate you always staying on top of latest! Hopefully soon these issues will be removed as Dawn gets removed and sysgpu gets stable on all platforms.

kamidev commented 7 months ago

Thank you! That is really good to know. I can verify that "zig build run -Duse_sysgpu=true" does start without freezing and functions correctly.

BTW, I'll be at Stephens Mach workshop at SYCL 2024 in Milan next month. So this is another good reason to stay on top of the latest. Keep up the good work!

kamidev commented 7 months ago

Functionality is fine, but using "zig build run -Duse_sysgpu=true" there is a memory leak from queue allocation. I can file a separate issue if you don't get that on Windows or Linux.

foxnne commented 7 months ago

Functionality is fine, but using "zig build run -Duse_sysgpu=true" there is a memory leak from queue allocation. I can file a separate issue if you don't get that on Windows or Linux.

Feel free to, this leak is being reported on all my projects. I mentioned it to Stephen, because I can't seem to figure out what is going on here. As far as I know, the queue should be freed by mach, but it must be something I have wrong on all my projects.

foxnne commented 7 months ago

BTW, I'll be at Stephens Mach workshop at SYCL 2024 in Milan next month. So this is another good reason to stay on top of the latest. Keep up the good work!

Jealous of this! I wish I could attend!