mellinoe / vk

Low-level Vulkan bindings for .NET.
Other
176 stars 35 forks source link

Can't load libvulkan in Linux Mint 19.2 #24

Open ItEndsWithTens opened 5 years ago

ItEndsWithTens commented 5 years ago

I got a report yesterday from another developer about one of my projects, which uses Veldrid, explaining that it failed when attempting to use Vulkan in Linux. His system supports it, but the exception thrown said it failed to load 'libvulkan.so', which was nowhere to be found. I've just confirmed it myself using the same distro, Linux Mint 19.2.

Apparently the issue is in vk/Commands.cs, in the GetVulkanName method, where it checks the condition

RuntimeInformation.OSDescription.Contains("Unix")

to determine if it's running in Android. I'm sorry to say that in Mint 19.2, OSDescription shows Unix 4.15.0.64, which throws off the check. In the meantime we can of course make symlinks to serve our development purposes, but out in the wild the program would fall back to OpenGL even on systems that supported Vulkan, and, you know, yuck.

Without Android experience of my own, I can't say I know any more robust methods to distinguish Android from regular desktop Linux, but I did notice that RuntimeInformation.FrameworkDescription, at least when running the program in question, contains the string Mono, if that's worth anything. Then again I'm targeting the full .NET framework, with Mono supporting the software in Linux and macOS, so a .NET Core app couldn't rely on that string being there, I guess.

EDIT: I caught a case of Temporary Big Dumb Idiot syndrome earlier (haha, "temporary") and forgot to check the Veldrid library itself. Just poking around now I see it too has a use of OSDescription to detect Android. I believe that would need to be updated too, to prevent a false negative when using IsBackendSupported. It doesn't seem worth opening a separate issue on the Veldrid repo for tracking purposes, but if you'd rather I do so I'll be happy to.

mellinoe commented 5 years ago

The GetVulkanName function can definitely be improved. I’ll try to set aside some time to implement and test that this weekend.

philstopford commented 4 years ago

Was this tackled? Curious about the current status.