DepthFlow icon indicating copy to clipboard operation
DepthFlow copied to clipboard

(BUG) Segmentation Fault on Apple Silicon when Compiling Shaders

Open springyuniverse opened this issue 1 year ago • 2 comments

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

zsh: segmentation fault depthflow any ideas?

springyuniverse avatar Apr 10 '24 04:04 springyuniverse

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 avatar Apr 10 '24 05:04 Tremeschin

(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 avatar Apr 10 '24 05:04 Tremeschin

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 avatar Aug 18 '24 10:08 Tremeschin

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 :) !

Tremeschin avatar Aug 21 '24 09:08 Tremeschin