-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 for MoltenVK #870
Comments
I'd love to add support for both MoltenVK and MoltenGL, if possible. |
Hope this thing happen! plz... |
Looking at your license, these sections seem to indicate that GLFW cannot include explicit support for MoltenVK.
|
Yes, MoltenVK (and MoltenGL) are distributed under a commercial license, and the sections you refer to would apply if GLFW intended to embed those products in its own distribution in licensed form. However, that is not necessary. The GLFW community can add support in the sense of using the MoltenVK (or MoltenGL) API if those libraries have been linked (or maybe selected via a build macro setting). It would then be up to the end app developers (i.e.- developers using GLFW) to download MoltenVK (or MoltenGL) and link it if they wanted to use the library. It would also be up to the end app developer to purchase the appropriate license before moving their app to production. In effect, Molten (either product) would be an optional library that is used if available. Another option would be for GLFW to include Molten in unlicensed form. That might allow GLFW to better coordinate versioning. It would then be up to an app developer who chose to use the Molten component to purchase the license when they want to go to production. Molten (both products) can be downloaded and used for development, both by GLFW developers and app developers without having to purchase a license. The Molten licenses only need to be purchased by the app developer when the end app is released for distribution. Does that clarify the licensing situation? I'm happy to answer any further questions. |
@billhollings Does Brenwill have a sample implementation of this? It should be relatively easy to plug into these and call MoltenVK from within:
But some guidance would be greatly appreciated. |
MoltenVK includes several demo apps that help illustrate how to create a Vulkan surface in iOS or macOS, and the If you have specific questions as you get into it, please post them to the MoltenVK support forum. ...Bill |
@billhollings This is the solution I would prefer, with detection at run-time for maximum ease of use. To clarify, if I add support for the MoltenVK WSI the same way as for the Khronos WSI, i.e. copy the necessary parts of the interface and search for the MoltenVK framework on demand (yes, that code would need to be updated to work with frameworks), this would not require a license from you either of us or any third-party using, modifying or distributing GLFW? |
Yes...you are correct. By modifying GLFW to enable access to MoltenVK, you (or anyone else distributing GLFW so modified) would NOT require a MoltenVK license. The MoltenVK licenses would be purchased by a developer who wanted to actually link MoltenVK to GLFW in a production app or game. Once they wanted to move their app to production (and remove the MoltenVK watermark), they would purchase a MoltenVK license for each developer who worked on their app or game (ie- who ran a build that linked the app or game with MoltenVK). |
@billhollings Perfect. Thank you. I'll start right away. |
Great! If there is anything we can help with, or if you have any questions, please don't hesitate to make use of the MoltenVK forum. |
|
Sorry about the delay; I've had much less time these past few weeks than I'd hoped. MoltenVK works beautifully and was easy to add support for. |
Nice work! No need to apologize for the delay...that was actually a rather fast turnaround! I'm glad the effort was fairly straightforward. The Triangle demo looks wonderful. Are there any other demos within the GLFW library that make use of Vulkan for testing with MoltenVK? If it's not too corporate, we would like to arrange a press release to announce that GLFW now supports Vulkan on macOS and iOS through MoltenVK. Would you mind if we include your rather positive quote above in that press release? No trouble either way...I completely understand if you'd rather not be seen to publicly endorse products outside GLFW. Thanks... ...Bill |
@elmindreda This is amazing, has it been pushed to any branch? I'd like to give it a try! Thanks. |
@billhollings Emphasis mine, but what makes you say that GLFW supports iOS? As far as I know, it does not. |
Thanks for pointing that out. My bad. I'm just used to automatically mentioning both OS's when discussing MoltenVK. :^) ...Bill |
This adds basic support for MoltenVK, a Vulkan implementation on top of Metal, on macOS 10.11 and later. It looks for MoltenVK in the process namespace via RTLD_DEFAULT symbol lookup if _GLFW_VULKAN_STATIC is disabled. However, it is recommended to enable _GLFW_VULKAN_STATIC if GLFW is being used as a static library. glfwCreateWindowSurface now creates and sets a CAMetalLayer for the window content view, which is required for MoltenVK to function. Fixes #870.
This adds basic support for MoltenVK, a Vulkan implementation on top of Metal, on macOS 10.11 and later. It looks for MoltenVK in the process namespace via RTLD_DEFAULT symbol lookup if _GLFW_VULKAN_STATIC is disabled. glfwCreateWindowSurface now creates and sets a CAMetalLayer for the window content view, which is required for MoltenVK to function. Fixes #870.
@billhollings Basic (and somewhat kludgy) support for MoltenVK has been merged with e94d166 and will be included in 3.3. It can of course be improved before release.
Not currently. I'm hoping to have time to write some, but GLFW itself takes priority.
That's fine [now that I've merged it]. Go ahead.
No, please don't quote me. The above issue aside, I haven't used enough of MoltenVK to give a verdict on the product as a whole yet. @fcvarela You can find it in |
There is also an occasional segfault remaining in |
Tested with MoltenVK 0.18.0. Related to #870.
Now that MolkenVK is open source, what would be needed to use GLFW with it through brew (glfwVulkanSupported() returns falsem and vkCreateInstance() fails)? Is that up to the brew settings? |
Hello, since the release of the MacOS SDK yesterday for Vulkan, I'm trying to get GLFW to work with it. @kusma You should use |
@Hindrik1997 Yup, sorry about that. Looking into it now. |
@Hindrik1997: Thanks for the tip. Sadly this didn't help me much, I still get the same problem (glfwVulkanSupported() returns non-true, vkCreateInstance() fails) with that version as well. glfwGetVersionString returns "3.3.0 Cocoa NSGL dynamic", and |
|
Yeah, even |
@kusma What I did was to setup a few environment variables for the SDK directoriesto my .bash_profile. Basically this: After that I included If you have added this correctly, vulkaninfo should just work from the terminal too. However, as I mentioned earlier, GLFW crashes when retrieving the VkSurface when using the loader lib. Directly linking to the MoltenVK library without the loader does seem to work though, but yeah, no layers or extensions then. |
@Hindrik1997: Sure, and I did :) OK, setting up VK_LAYER_PATH and VK_ICD_FILENAMES as you suggested made vulkaninfo work just fine. Sadly, it didn't help with my |
@kusma Yes, those variables are required for the Vulkan loader to figure out where it can find the driver's implementation. (Hence the name, Installable Client Driver) Same goes for the layers and extensions. |
Reinstalling GLFW from brew (HEAD) after setting these environment doesn't seem to help for me. I seem to still get a GLFW without any vulkan support. I link to the loader, not MoltenVK.dylib. I don't use CMake, I use meson. But I think the result should be the same. |
@kusma |
GLFW now checks for the libvulkan.1.dylib loader instead of what is now the ICD. This removes checking for libMoltenVK.dylib to avoid cryptic errors. This unfortunately also breaks compatibility with the standalone MoltenVK SDK. This also removes support for the static loader library as that is not present in the LunarG SDK. Related to #870.
@Hindrik1997: I can create vulkan-instances just fine, but |
Here's a stripped down version of my project. configure: |
@kusma The only thing that is definately a problem is the following line in your meson.build: Check which version is linked by printing out the What does the rpath stuff do? And do you link statically or dynamically with GLFW? |
@Hindrik1997: It always failed with a return value for me. And yes, I'm aware that I need GLFW 3.3, but in my case that's what I've got installed. Changing it in the meson.build-file won't change anything. Also, as I said above, The rpath-stuff isn't needed, and.... uh. Yeah, I just found out what the problem was; I had a typo in my DYLD_LIBRARY_PATH-variable. And my rpath-stuff was papering over the symptoms of this. Sorry for the noise, and thanks a lot for the help! |
OK, things works now. I get a validation issue, though:
Also, at the end of my application, I do a |
The surface creation structure type should be something related to GLFW I think. It probably forgets to set it to the right type. Either way, you should use vkDeviceWaitIdle() instead. Make sure no command buffers are in flight anymore. |
Value changed between MoltenVK 0.15 and 0.16 and GLFW was never updated. Related to #870.
Found it. The value of |
@elmindreda: Nice. I can confirm that this is no longer a problem :) |
GLFW now checks for the libvulkan.1.dylib loader instead of what is now the ICD. This removes checking for libMoltenVK.dylib to avoid cryptic errors. This unfortunately also breaks compatibility with the standalone MoltenVK SDK. This also removes support for the static loader library as that is not present in the LunarG SDK. Related to glfw#870.
Value changed between MoltenVK 0.15 and 0.16 and GLFW was never updated. Related to glfw#870.
We at Brenwill, developers of MoltenVK, have received user interest in GLFW supporting Vulkan on macOS (and iOS) by linking to MoltenVK.
If there is GLFW community interest in this, we'd be happy to provide whatever support and advice we can to anyone in the GLFW development community who wishes to update GLFW to support Vulkan on macOS via MoltenVK.
...Bill
The text was updated successfully, but these errors were encountered: