Skip to content

Fix to ImGuiVulkan Experiment to run on MacOSX #1197

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

Merged
merged 7 commits into from
Jan 8, 2023
Merged

Fix to ImGuiVulkan Experiment to run on MacOSX #1197

merged 7 commits into from
Jan 8, 2023

Conversation

viniciusmiguel
Copy link
Contributor

Summary of the PR

The current implementation only works on Windows, based on my tests it was never validated over MoltenVK,
I successfully managed to run on the Mac after troubleshooting and fixing the Vulkan initialisation config.

Related issues, Discord discussions, or proposals

My proposal is to bring the fixes to the Experiment and hopefully some enhancements to make this an official example.

The MoltenVK library (dylib) is considered as an ICD (Installable Client Driver) by the Vulkan loader. The Vulkan loader dynamically loads ICDs at execution time. When using the Vulkan loader, ICDs are not linked directly to the application. Similarly, the Vulkan loader dynamically loads the layers at execution time. Layers are not linked directly to the application.
The MoltenVK library is a little unusual because it is built in such a way that an application can link to it directly and run MoltenVK (Vulkan subset) applications without using the loader and layers. But if you want to use the loader and layers, you don't link MoltenVK and the layers to your application. You link only the loader. The loader then dynamically loads the MoltenVK lib as an ICD and dynamically loads the layers if requested.
Updating to net6.0
Including Constants for different OSes
Rolling back OS Constants
Included KHR portability subset to work on MoltenVK.
Bit set into InstanceCreateInfo for Enumerate Portability.

The project works on MacOS 13.1 now on Apple Silicon.
@viniciusmiguel
Copy link
Contributor Author

The project works out of the box over Rosetta with the changes proposed.
On my test project, I also compiled native arm64 but for that to work, it was necessary to download ImGui.NET and build it locally.

@viniciusmiguel viniciusmiguel marked this pull request as ready for review January 2, 2023 19:22
@viniciusmiguel viniciusmiguel requested review from HurricanKai and a team as code owners January 2, 2023 19:22
Using a different approach proposed by the corefx team.
Copy link
Member

@Perksey Perksey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine but again RuntimeInformation is deprecated, please start using OperatingSystem APIs in the future (they're also a lot more obvious to use!).

@Perksey Perksey enabled auto-merge (squash) January 8, 2023 15:49
@Perksey Perksey merged commit e7eb63f into dotnet:main Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants