-
Notifications
You must be signed in to change notification settings - Fork 114
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
Support building on macOS with MoltenVK #2
Comments
Hi @Nadrin I managed to compile the project using MoltenVK by modifying two lines the of CMake file (it is possible that the variables are wrong on macOS?), changing Dependencies can be installed by issuing:
where But the demo cannot run neither in OpenGL nor Vulkan:
Inspecting a bit I saw that for OpenGL, is trying to create a 4.5 context, something impossible to macOS, so it is expected to fail. For Vulkan, volk is trying to load a library with name #include <dlfcn.h>
VkResult volkInitialize_mac() {
void* module = dlopen("libMoltenVK.dylib", RTLD_NOW | RTLD_LOCAL);
if (!module)
return VK_ERROR_INITIALIZATION_FAILED;
volkInitializeCustom((PFN_vkGetInstanceProcAddr)dlsym(module, "vkGetInstanceProcAddr"));
return VK_SUCCESS;
} And modifying the #if __APPLE__ && __MACH__
if(VKFAILED(volkInitialize_mac())) {
throw std::runtime_error("Vulkan loader has not been found");
}
#else
if(VKFAILED(volkInitialize())) {
throw std::runtime_error("Vulkan loader has not been found");
}
#endif And it started to run, and show a little log. But then it suddenly closes, here is the log:
So here I end my ideas. Hope it helps clarify something about support for macOS. Anything you want to try on Mac, count on me :) I will try to test. Note: I'm using macOS 10.12.6 |
Are you only linking to MoltenVK? I don't have a Mac on me atm, but i do remember that the Vulkan SDK for Mac includes 2 library files, with the first one being MoltenVK, and the second one being either vulkan.framework, or libvulkan.1.dylib, which includes the standard debugging layers. As a result, i think you're getting those errors due to only linking to MoltenVK |
More or less, you have a point @isaboll1 . I downloaded the wrong (and old) MoltenVK. So, downloading LunarG Vulkan SDK, setting the env variable After that, another error occurred with GLFW. Googling a bit, I end up with this issue. Basically, use GLFW 3.3, not yet released. To do it with brew: I also disabled the debugging stuff of the debugging layers you mentioned because in the output of With that, I can see stuff being loaded in memory. Wait, another error:
Well, at least I could see start doing things :) As far as I know, |
@melchor629 I've done a quick google search and it seems that MoltenVK, for some reason, generated invalid Metal shader code from SPIR-V representation. I have no idea, however, whether it's a bug or a limitation of MoltenVK, or if it's caused by something I've done in my Vulkan code. Also, I just wanted to let you guys know that I really appreciate the troubleshooting that you're doing! Hope this reaches a satisfactory conclusion and in the end we'll have that macOS build. Keep it up! :) |
Thanks @Nadrin :) Well, I have to say I have no idea of Vulkan so I'm not be able to try things over the shaders or any other stuff of Vulkan. But one thing that may help is the list of MoltenVK limitations, maybe there's something that your project is using and is listed here. If not, maybe it is a bug of MoltenVK and should be reported. |
It would be great if someone modified
projects/cmake/CMakeLists.txt
to make this project build on macOS using MoltenVK. Unfortunately I don't have access to any Apple hardware to do it myself.The text was updated successfully, but these errors were encountered: