Linux build fix

This commit is contained in:
Connor McLaughlin 2020-06-19 01:36:46 +10:00
parent 1212d24ea9
commit c023bcd234
3 changed files with 6 additions and 9 deletions

View file

@ -111,12 +111,7 @@ bool LoadVulkanLibrary()
if (libvulkan_env) if (libvulkan_env)
vulkan_module = dlopen(libvulkan_env, RTLD_NOW); vulkan_module = dlopen(libvulkan_env, RTLD_NOW);
if (!vulkan_module) if (!vulkan_module)
{ vulkan_module = dlopen("libvulkan.dylib", RTLD_NOW);
// Use the libvulkan.dylib from the application bundle.
std::string executable_path = FileSystem::GetProgramPath();
std::string path = FileSystem::GetPathDirectory(executable_path.c_str()) + "/libvulkan.dylib";
vulkan_module = dlopen(path.c_str(), RTLD_NOW);
}
#else #else
// Names of libraries to search. Desktop should use libvulkan.so.1 or libvulkan.so. // Names of libraries to search. Desktop should use libvulkan.so.1 or libvulkan.so.
static const char* search_lib_names[] = {"libvulkan.so.1", "libvulkan.so"}; static const char* search_lib_names[] = {"libvulkan.so.1", "libvulkan.so"};

View file

@ -400,7 +400,7 @@ std::string ShaderCache::GetPipelineCacheBaseFileName(const std::string_view& ba
ShaderCache::CacheIndexKey ShaderCache::GetCacheKey(ShaderCompiler::Type type, const std::string_view& shader_code) ShaderCache::CacheIndexKey ShaderCache::GetCacheKey(ShaderCompiler::Type type, const std::string_view& shader_code)
{ {
union union HashParts
{ {
struct struct
{ {
@ -409,12 +409,13 @@ ShaderCache::CacheIndexKey ShaderCache::GetCacheKey(ShaderCompiler::Type type, c
}; };
u8 hash[16]; u8 hash[16];
}; };
HashParts h;
MD5Digest digest; MD5Digest digest;
digest.Update(shader_code.data(), static_cast<u32>(shader_code.length())); digest.Update(shader_code.data(), static_cast<u32>(shader_code.length()));
digest.Final(hash); digest.Final(h.hash);
return CacheIndexKey{hash_low, hash_high, static_cast<u32>(shader_code.length()), type}; return CacheIndexKey{h.hash_low, h.hash_high, static_cast<u32>(shader_code.length()), type};
} }
std::optional<ShaderCompiler::SPIRVCodeVector> ShaderCache::GetShaderSPV(ShaderCompiler::Type type, std::optional<ShaderCompiler::SPIRVCodeVector> ShaderCache::GetShaderSPV(ShaderCompiler::Type type,

View file

@ -4,6 +4,7 @@
#include "shader_compiler.h" #include "shader_compiler.h"
#include "vulkan_loader.h" #include "vulkan_loader.h"
#include <cstdio> #include <cstdio>
#include <memory>
#include <optional> #include <optional>
#include <string_view> #include <string_view>
#include <unordered_map> #include <unordered_map>