-
Notifications
You must be signed in to change notification settings - Fork 3
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
MacOS support progress/discussion #31
Comments
Do you have a public fork of the samples w/ your changes? I just generated (locally) on mac against 1.2.177. Sample 0 runs successfully for me, but I would like to duplicate the error what you are seeing. |
@bbredesen I pushed a draft PR in the samples repo. Haven't had a chance to keep working on it. Sample 00 works fine for me too without any changes (besides removing the error strings), the problems occur in sample 01. Would be cool if you can test the GLFW version on windows too, at least some of that code could be useful for cross platform support :) |
I ran into a ton of issues trying to use GLFW too. GLFW is taking the instance parameter as an interface{} and then using reflection to determine if the handle is a pointer, so I'm wondering if GLFW is doing something weird with Vulkan handles. Dispatchable handles are pointers to a function dispatch table in Vulkan, but intended to be opaque to the programmer, so I don't know why GLFW wants the handle to be a pointer type. I didn't want to dig too deeply into GLFW so I've adapted the "shared" win32 code to also work with Cocoa, calling out to Objective-C. The good news is that go-vk seems to work just fine on Mac: I ended up refactoring the whole shared window message model, with impact on how the individual samples setup and start the window. I'm going to push a new branch to [go-vk-samples] shortly, with the caveat that only the basic triangle sample will compile at the moment, so I haven't done much testing yet. Solving GLFW+go-vk may end up being a requirement though...it is a well-known and commonly used library, and probably a lot of people's first choice to quickly open a opengl or vulkan window on their platform. |
And also note that I generated a local copy of vk-go against 1.2.203 (last 1.2 revision of vk.xml), with -platform="win32,macos,metal". I'll also push a branch of go-vk for 1.2. Branch: https://github.com/bbredesen/go-vk/tree/1.2.203-darwin |
Really cool, nice work! And yeah, this is pretty much the exact use case for GLFW and avoiding it will involve basically re-implementing it, so its probably worth the effort. If it turns out to be too annoying, another idea is to try using SDL2 for cross platform windowing first. Anyway, (C.VkInstance)(unsafe.Pointer(reflect.ValueOf(instance).Pointer())) is just a trick to allow any Go object to be cast to a |
The rest of the samples have been updated on the shared-framework-update branch and now run on (my) mac. |
So I managed to get a bit further on MacOS support tonight.
VkSurfaceKHR
handle from the GLFW windowTo get it working I had to change the default library name from
libMoltenVK.dylib
to the standardlibvulkan.1.dylib
. I havent looked into it, but i seem to recall that being correct for newer versions of MVK.I'm currently stuck at a crash in
vk.GetPhysicalDeviceSurfaceSupportKHR
, with the outputI'm not sure what's causing it, but I'm a little bit suspicious towards the use of
dlsym
for loading function pointers. As far as I can tell the recommended way is to usevkGetInstanceProcAdd
andvkGetDeviceProcAddr
, and other platform-specific methods are not supported except as a way to locate those two methods.The text was updated successfully, but these errors were encountered: