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

(BUG) Segmentation Fault on Apple Silicon when Compiling Shaders #13

Closed
springyuniverse opened this issue Apr 10, 2024 · 4 comments
Closed
Assignees
Labels
Bug Unexpected behavior Help Wanted Unavailable knowledge or resources

Comments

@springyuniverse
Copy link

Hi I am running Depthflow on Mac Silicon and currently whenever I run depthflow I got

zsh: segmentation fault depthflow any ideas?

@Tremeschin
Copy link
Member

Tremeschin commented Apr 10, 2024

Hello! It's a recently known and broader issue that affects ShaderFlow entirely atm :(

I don't have the hardware to test, but have bounced some ideas and tried a few things with a friend of mine Python developer from the USA that have it, but we couldn't find the root cause

Thanks for opening the issue, I should've done it earlier this week 👍🏻

@Tremeschin
Copy link
Member

Tremeschin commented Apr 10, 2024

(my best idea and help needed)

After some inspection, it was quite clear that it happens right when compiling the shaders in this line, could well be unsupported types or extensions from Apple's implementation of OpenGL, as well as a bug in ModernGL Python wrapper, GLFW window, or macOS trying to use native ARM than x86_64 in compatibility mode with Rosetta (mayhaps even rye package manager installing x86 when it should do ARM?)

I'm not familiar with macOS to point at anything specific, but I will spin up a vm and debug myself eventually !

@Tremeschin Tremeschin added Bug Unexpected behavior Help Wanted Unavailable knowledge or resources labels Apr 10, 2024
@Tremeschin Tremeschin changed the title (BUG) segmentation fault depthflow (BUG) Segmentation Fault on Apple Silicon when Compiling Shaders Apr 10, 2024
@Tremeschin Tremeschin pinned this issue Apr 10, 2024
@Tremeschin
Copy link
Member

Tremeschin commented Aug 18, 2024

Friend of mine let me use VSCode's live share feature and debug the code myself, after about 3 hours of work,,

image

I made it work on native Apple Silicon. There was an platform specific OpenGL undefined behaviour that NVIDIA/AMD/Intel was fine with, but segfaulted the shader compilation; and also the texture indexes must be in order on macOS, and guess what, it's fine for the others

currently only available from source https://brokensrc.dev/get/source/, will be part of the 0.6.0 release as some internal stuff changed

let me know if it works now!, also fixed some torch installation* issues

*didn't test the code to download a ffmpeg release, it might fail, in that case just brew install ffmpeg

@Tremeschin
Copy link
Member

I've had a user or two on Discord this week on Apple Silicon M1/M2 reporting that it worked on git main, and I've just pushed v0.6.0 wheels on PyPI with these macOS fixes

there's probably an issue or two regarding downloading ffmpeg or the webui, I can debug further when I get access to the hardware again, worst case a brew install ffmpeg might be needed for exporting to videos

feel free to reopen if there's more opengl specifics of macos going bad :) !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected behavior Help Wanted Unavailable knowledge or resources
Projects
None yet
Development

No branches or pull requests

2 participants