amerkoleci / Vortice.Vulkan

Cross platform .NET bindings for Vulkan, VMA, SPIRV-Cross and shaderc
MIT License
298 stars 26 forks source link

shaderc_shared.dll is not found #17

Closed manuelxmarquez closed 3 years ago

manuelxmarquez commented 3 years ago

shaderc_shared.dll is not found when compiling shaders. It was working on my development machine but not on a build server. I found that the code in LibraryLoader was not finding the file and falling back to the OS default and was finding it in the Vulkan SDK folder which is in PATH.

I verified this by using this code:

            IntPtr handle;
#if NETSTANDARD2_0
            handle = LoadPlatformLibrary(libraryPath);
#else
            handle = NativeLibrary.Load(libraryPath);
#endif

            if (handle == IntPtr.Zero)
                throw new DllNotFoundException($"Unable to load library '{libraryName}'.");

            var sbPath = new StringBuilder(1024);
            var count = Win32.GetModuleFileNameA(handle, sbPath, sbPath.Capacity);

            Console.WriteLine(sbPath);

            [DllImport(SystemLibrary, SetLastError = true, CharSet = CharSet.Ansi)]
            public static extern int GetModuleFileNameA(IntPtr hModule, StringBuilder lpFileName, int nSize);