FacticiusVir / SharpVk

C# Bindings for the Vulkan API & SPIR-V
MIT License
147 stars 18 forks source link

No layers reported when run outside of console. #56

Closed Loen10 closed 4 years ago

Loen10 commented 4 years ago

When running my application by simply double clicking the executable, it crashes as no layers are reported via Instance.EnumerateLayerProperties.

I'm fairly certain this is because when it is run without a console, the application does not have access to my enviornment variables that I have set up for Vulkan. But I don't know how I could fix this.

INFO: OS: Linux Mint 19.2 SharpVk Nuget Version: 0.4.2 .NET Core Version: 3.0

FacticiusVir commented 4 years ago

Interesting - to confirm, if you run a console application and call Instance.EnumerateLayerProperties, do you get the current list of arrays?

Loen10 commented 4 years ago

Yes, it reports all the layers when run from a console, both by doing "dotnet run", and "./executable".

Loen10 commented 4 years ago

Also, is it normal to have to install the VulkanSDK along with SharpVk, if so what should I do to properly link the two?

FacticiusVir commented 4 years ago

The Vulkan SDK is not necessary, but it does provide validation layers & debugging information so I'd highly recommend it. There's no explicit linking required to use those layers from SharpVk.

I'm usually working on Windows, but I'll set up a test rig and see if I can replicate your issue.

Loen10 commented 4 years ago

Ok so I tested the issue with a C++ executable using the Vulkan SDK and it did the same thing.

So the problem is not unique to SharpVk.

My solution was to run the executable from a script file that sets the enviornment variables before running the executable. Or I could set them from within the runtime code itself.