diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2021-05-26 01:32:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-26 01:32:56 +0200 |
commit | 065867e2c24e9856c360fc2d6b9a86c92aedc43e (patch) | |
tree | 7964e85ef4f01a3c2b8f44e850f37b384405b930 /src/video_core | |
parent | Merge pull request #6349 from german77/suppress_config_warning (diff) | |
download | yuzu-065867e2c24e9856c360fc2d6b9a86c92aedc43e.tar yuzu-065867e2c24e9856c360fc2d6b9a86c92aedc43e.tar.gz yuzu-065867e2c24e9856c360fc2d6b9a86c92aedc43e.tar.bz2 yuzu-065867e2c24e9856c360fc2d6b9a86c92aedc43e.tar.lz yuzu-065867e2c24e9856c360fc2d6b9a86c92aedc43e.tar.xz yuzu-065867e2c24e9856c360fc2d6b9a86c92aedc43e.tar.zst yuzu-065867e2c24e9856c360fc2d6b9a86c92aedc43e.zip |
Diffstat (limited to 'src/video_core')
5 files changed, 116 insertions, 106 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp index dbcb751cb..0deb86517 100644 --- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp @@ -7,9 +7,10 @@ #include <fmt/format.h> #include "common/assert.h" -#include "common/common_paths.h" #include "common/common_types.h" -#include "common/file_util.h" +#include "common/fs/file.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h" #include "common/logging/log.h" #include "common/scm_rev.h" #include "common/settings.h" @@ -26,11 +27,7 @@ using Tegra::Engines::ShaderType; using VideoCommon::Shader::BindlessSamplerMap; using VideoCommon::Shader::BoundSamplerMap; using VideoCommon::Shader::KeyMap; - -namespace { - using VideoCommon::Shader::SeparateSamplerKey; - using ShaderCacheVersionHash = std::array<u8, 64>; struct ConstBufferKey { @@ -58,6 +55,8 @@ struct BindlessSamplerEntry { Tegra::Engines::SamplerDescriptor sampler; }; +namespace { + constexpr u32 NativeVersion = 21; ShaderCacheVersionHash GetShaderCacheVersionHash() { @@ -74,22 +73,20 @@ ShaderDiskCacheEntry::ShaderDiskCacheEntry() = default; ShaderDiskCacheEntry::~ShaderDiskCacheEntry() = default; bool ShaderDiskCacheEntry::Load(Common::FS::IOFile& file) { - if (file.ReadBytes(&type, sizeof(u32)) != sizeof(u32)) { + if (!file.ReadObject(type)) { return false; } u32 code_size; u32 code_size_b; - if (file.ReadBytes(&code_size, sizeof(u32)) != sizeof(u32) || - file.ReadBytes(&code_size_b, sizeof(u32)) != sizeof(u32)) { + if (!file.ReadObject(code_size) || !file.ReadObject(code_size_b)) { return false; } code.resize(code_size); code_b.resize(code_size_b); - - if (file.ReadArray(code.data(), code_size) != code_size) { + if (file.Read(code) != code_size) { return false; } - if (HasProgramA() && file.ReadArray(code_b.data(), code_size_b) != code_size_b) { + if (HasProgramA() && file.Read(code_b) != code_size_b) { return false; } @@ -99,13 +96,12 @@ bool ShaderDiskCacheEntry::Load(Common::FS::IOFile& file) { u32 num_bound_samplers; u32 num_separate_samplers; u32 num_bindless_samplers; - if (file.ReadArray(&unique_identifier, 1) != 1 || file.ReadArray(&bound_buffer, 1) != 1 || - file.ReadArray(&is_texture_handler_size_known, 1) != 1 || - file.ReadArray(&texture_handler_size_value, 1) != 1 || - file.ReadArray(&graphics_info, 1) != 1 || file.ReadArray(&compute_info, 1) != 1 || - file.ReadArray(&num_keys, 1) != 1 || file.ReadArray(&num_bound_samplers, 1) != 1 || - file.ReadArray(&num_separate_samplers, 1) != 1 || - file.ReadArray(&num_bindless_samplers, 1) != 1) { + if (!file.ReadObject(unique_identifier) || !file.ReadObject(bound_buffer) || + !file.ReadObject(is_texture_handler_size_known) || + !file.ReadObject(texture_handler_size_value) || !file.ReadObject(graphics_info) || + !file.ReadObject(compute_info) || !file.ReadObject(num_keys) || + !file.ReadObject(num_bound_samplers) || !file.ReadObject(num_separate_samplers) || + !file.ReadObject(num_bindless_samplers)) { return false; } if (is_texture_handler_size_known) { @@ -116,13 +112,10 @@ bool ShaderDiskCacheEntry::Load(Common::FS::IOFile& file) { std::vector<BoundSamplerEntry> flat_bound_samplers(num_bound_samplers); std::vector<SeparateSamplerEntry> flat_separate_samplers(num_separate_samplers); std::vector<BindlessSamplerEntry> flat_bindless_samplers(num_bindless_samplers); - if (file.ReadArray(flat_keys.data(), flat_keys.size()) != flat_keys.size() || - file.ReadArray(flat_bound_samplers.data(), flat_bound_samplers.size()) != - flat_bound_samplers.size() || - file.ReadArray(flat_separate_samplers.data(), flat_separate_samplers.size()) != - flat_separate_samplers.size() || - file.ReadArray(flat_bindless_samplers.data(), flat_bindless_samplers.size()) != - flat_bindless_samplers.size()) { + if (file.Read(flat_keys) != flat_keys.size() || + file.Read(flat_bound_samplers) != flat_bound_samplers.size() || + file.Read(flat_separate_samplers) != flat_separate_samplers.size() || + file.Read(flat_bindless_samplers) != flat_bindless_samplers.size()) { return false; } for (const auto& entry : flat_keys) { @@ -145,26 +138,25 @@ bool ShaderDiskCacheEntry::Load(Common::FS::IOFile& file) { } bool ShaderDiskCacheEntry::Save(Common::FS::IOFile& file) const { - if (file.WriteObject(static_cast<u32>(type)) != 1 || - file.WriteObject(static_cast<u32>(code.size())) != 1 || - file.WriteObject(static_cast<u32>(code_b.size())) != 1) { + if (!file.WriteObject(static_cast<u32>(type)) || + !file.WriteObject(static_cast<u32>(code.size())) || + !file.WriteObject(static_cast<u32>(code_b.size()))) { return false; } - if (file.WriteArray(code.data(), code.size()) != code.size()) { + if (file.Write(code) != code.size()) { return false; } - if (HasProgramA() && file.WriteArray(code_b.data(), code_b.size()) != code_b.size()) { + if (HasProgramA() && file.Write(code_b) != code_b.size()) { return false; } - if (file.WriteObject(unique_identifier) != 1 || file.WriteObject(bound_buffer) != 1 || - file.WriteObject(static_cast<u8>(texture_handler_size.has_value())) != 1 || - file.WriteObject(texture_handler_size.value_or(0)) != 1 || - file.WriteObject(graphics_info) != 1 || file.WriteObject(compute_info) != 1 || - file.WriteObject(static_cast<u32>(keys.size())) != 1 || - file.WriteObject(static_cast<u32>(bound_samplers.size())) != 1 || - file.WriteObject(static_cast<u32>(separate_samplers.size())) != 1 || - file.WriteObject(static_cast<u32>(bindless_samplers.size())) != 1) { + if (!file.WriteObject(unique_identifier) || !file.WriteObject(bound_buffer) || + !file.WriteObject(static_cast<u8>(texture_handler_size.has_value())) || + !file.WriteObject(texture_handler_size.value_or(0)) || !file.WriteObject(graphics_info) || + !file.WriteObject(compute_info) || !file.WriteObject(static_cast<u32>(keys.size())) || + !file.WriteObject(static_cast<u32>(bound_samplers.size())) || + !file.WriteObject(static_cast<u32>(separate_samplers.size())) || + !file.WriteObject(static_cast<u32>(bindless_samplers.size()))) { return false; } @@ -197,13 +189,10 @@ bool ShaderDiskCacheEntry::Save(Common::FS::IOFile& file) const { BindlessSamplerEntry{address.first, address.second, sampler}); } - return file.WriteArray(flat_keys.data(), flat_keys.size()) == flat_keys.size() && - file.WriteArray(flat_bound_samplers.data(), flat_bound_samplers.size()) == - flat_bound_samplers.size() && - file.WriteArray(flat_separate_samplers.data(), flat_separate_samplers.size()) == - flat_separate_samplers.size() && - file.WriteArray(flat_bindless_samplers.data(), flat_bindless_samplers.size()) == - flat_bindless_samplers.size(); + return file.Write(flat_keys) == flat_keys.size() && + file.Write(flat_bound_samplers) == flat_bound_samplers.size() && + file.Write(flat_separate_samplers) == flat_separate_samplers.size() && + file.Write(flat_bindless_samplers) == flat_bindless_samplers.size(); } ShaderDiskCacheOpenGL::ShaderDiskCacheOpenGL() = default; @@ -221,7 +210,8 @@ std::optional<std::vector<ShaderDiskCacheEntry>> ShaderDiskCacheOpenGL::LoadTran return std::nullopt; } - Common::FS::IOFile file(GetTransferablePath(), "rb"); + Common::FS::IOFile file{GetTransferablePath(), Common::FS::FileAccessMode::Read, + Common::FS::FileType::BinaryFile}; if (!file.IsOpen()) { LOG_INFO(Render_OpenGL, "No transferable shader cache found"); is_usable = true; @@ -229,7 +219,7 @@ std::optional<std::vector<ShaderDiskCacheEntry>> ShaderDiskCacheOpenGL::LoadTran } u32 version{}; - if (file.ReadBytes(&version, sizeof(version)) != sizeof(version)) { + if (!file.ReadObject(version)) { LOG_ERROR(Render_OpenGL, "Failed to get transferable cache version, skipping it"); return std::nullopt; } @@ -249,7 +239,7 @@ std::optional<std::vector<ShaderDiskCacheEntry>> ShaderDiskCacheOpenGL::LoadTran // Version is valid, load the shaders std::vector<ShaderDiskCacheEntry> entries; - while (file.Tell() < file.GetSize()) { + while (static_cast<u64>(file.Tell()) < file.GetSize()) { ShaderDiskCacheEntry& entry = entries.emplace_back(); if (!entry.Load(file)) { LOG_ERROR(Render_OpenGL, "Failed to load transferable raw entry, skipping"); @@ -266,7 +256,8 @@ std::vector<ShaderDiskCachePrecompiled> ShaderDiskCacheOpenGL::LoadPrecompiled() return {}; } - Common::FS::IOFile file(GetPrecompiledPath(), "rb"); + Common::FS::IOFile file{GetPrecompiledPath(), Common::FS::FileAccessMode::Read, + Common::FS::FileType::BinaryFile}; if (!file.IsOpen()) { LOG_INFO(Render_OpenGL, "No precompiled shader cache found"); return {}; @@ -286,7 +277,9 @@ std::optional<std::vector<ShaderDiskCachePrecompiled>> ShaderDiskCacheOpenGL::Lo Common::FS::IOFile& file) { // Read compressed file from disk and decompress to virtual precompiled cache file std::vector<u8> compressed(file.GetSize()); - file.ReadBytes(compressed.data(), compressed.size()); + if (file.Read(compressed) != file.GetSize()) { + return std::nullopt; + } const std::vector<u8> decompressed = Common::Compression::DecompressDataZSTD(compressed); SaveArrayToPrecompiled(decompressed.data(), decompressed.size()); precompiled_cache_virtual_file_offset = 0; @@ -321,9 +314,9 @@ std::optional<std::vector<ShaderDiskCachePrecompiled>> ShaderDiskCacheOpenGL::Lo } void ShaderDiskCacheOpenGL::InvalidateTransferable() { - if (!Common::FS::Delete(GetTransferablePath())) { + if (!Common::FS::RemoveFile(GetTransferablePath())) { LOG_ERROR(Render_OpenGL, "Failed to invalidate transferable file={}", - GetTransferablePath()); + Common::FS::PathToUTF8String(GetTransferablePath())); } InvalidatePrecompiled(); } @@ -332,8 +325,9 @@ void ShaderDiskCacheOpenGL::InvalidatePrecompiled() { // Clear virtaul precompiled cache file precompiled_cache_virtual_file.Resize(0); - if (!Common::FS::Delete(GetPrecompiledPath())) { - LOG_ERROR(Render_OpenGL, "Failed to invalidate precompiled file={}", GetPrecompiledPath()); + if (!Common::FS::RemoveFile(GetPrecompiledPath())) { + LOG_ERROR(Render_OpenGL, "Failed to invalidate precompiled file={}", + Common::FS::PathToUTF8String(GetPrecompiledPath())); } } @@ -398,16 +392,18 @@ Common::FS::IOFile ShaderDiskCacheOpenGL::AppendTransferableFile() const { const auto transferable_path{GetTransferablePath()}; const bool existed = Common::FS::Exists(transferable_path); - Common::FS::IOFile file(transferable_path, "ab"); + Common::FS::IOFile file{transferable_path, Common::FS::FileAccessMode::Append, + Common::FS::FileType::BinaryFile}; if (!file.IsOpen()) { - LOG_ERROR(Render_OpenGL, "Failed to open transferable cache in path={}", transferable_path); + LOG_ERROR(Render_OpenGL, "Failed to open transferable cache in path={}", + Common::FS::PathToUTF8String(transferable_path)); return {}; } if (!existed || file.GetSize() == 0) { // If the file didn't exist, write its version - if (file.WriteObject(NativeVersion) != 1) { + if (!file.WriteObject(NativeVersion)) { LOG_ERROR(Render_OpenGL, "Failed to write transferable cache version in path={}", - transferable_path); + Common::FS::PathToUTF8String(transferable_path)); return {}; } } @@ -429,51 +425,54 @@ void ShaderDiskCacheOpenGL::SaveVirtualPrecompiledFile() { const std::vector<u8> compressed = Common::Compression::CompressDataZSTDDefault(uncompressed.data(), uncompressed.size()); - const auto precompiled_path{GetPrecompiledPath()}; - Common::FS::IOFile file(precompiled_path, "wb"); + const auto precompiled_path = GetPrecompiledPath(); + Common::FS::IOFile file{precompiled_path, Common::FS::FileAccessMode::Write, + Common::FS::FileType::BinaryFile}; if (!file.IsOpen()) { - LOG_ERROR(Render_OpenGL, "Failed to open precompiled cache in path={}", precompiled_path); + LOG_ERROR(Render_OpenGL, "Failed to open precompiled cache in path={}", + Common::FS::PathToUTF8String(precompiled_path)); return; } - if (file.WriteBytes(compressed.data(), compressed.size()) != compressed.size()) { + if (file.Write(compressed) != compressed.size()) { LOG_ERROR(Render_OpenGL, "Failed to write precompiled cache version in path={}", - precompiled_path); + Common::FS::PathToUTF8String(precompiled_path)); } } bool ShaderDiskCacheOpenGL::EnsureDirectories() const { - const auto CreateDir = [](const std::string& dir) { + const auto CreateDir = [](const std::filesystem::path& dir) { if (!Common::FS::CreateDir(dir)) { - LOG_ERROR(Render_OpenGL, "Failed to create directory={}", dir); + LOG_ERROR(Render_OpenGL, "Failed to create directory={}", + Common::FS::PathToUTF8String(dir)); return false; } return true; }; - return CreateDir(Common::FS::GetUserPath(Common::FS::UserPath::ShaderDir)) && + return CreateDir(Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir)) && CreateDir(GetBaseDir()) && CreateDir(GetTransferableDir()) && CreateDir(GetPrecompiledDir()); } -std::string ShaderDiskCacheOpenGL::GetTransferablePath() const { - return Common::FS::SanitizePath(GetTransferableDir() + DIR_SEP_CHR + GetTitleID() + ".bin"); +std::filesystem::path ShaderDiskCacheOpenGL::GetTransferablePath() const { + return GetTransferableDir() / fmt::format("{}.bin", GetTitleID()); } -std::string ShaderDiskCacheOpenGL::GetPrecompiledPath() const { - return Common::FS::SanitizePath(GetPrecompiledDir() + DIR_SEP_CHR + GetTitleID() + ".bin"); +std::filesystem::path ShaderDiskCacheOpenGL::GetPrecompiledPath() const { + return GetPrecompiledDir() / fmt::format("{}.bin", GetTitleID()); } -std::string ShaderDiskCacheOpenGL::GetTransferableDir() const { - return GetBaseDir() + DIR_SEP "transferable"; +std::filesystem::path ShaderDiskCacheOpenGL::GetTransferableDir() const { + return GetBaseDir() / "transferable"; } -std::string ShaderDiskCacheOpenGL::GetPrecompiledDir() const { - return GetBaseDir() + DIR_SEP "precompiled"; +std::filesystem::path ShaderDiskCacheOpenGL::GetPrecompiledDir() const { + return GetBaseDir() / "precompiled"; } -std::string ShaderDiskCacheOpenGL::GetBaseDir() const { - return Common::FS::GetUserPath(Common::FS::UserPath::ShaderDir) + DIR_SEP "opengl"; +std::filesystem::path ShaderDiskCacheOpenGL::GetBaseDir() const { + return Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir) / "opengl"; } std::string ShaderDiskCacheOpenGL::GetTitleID() const { diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.h b/src/video_core/renderer_opengl/gl_shader_disk_cache.h index aef841c1d..f8bc23868 100644 --- a/src/video_core/renderer_opengl/gl_shader_disk_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.h @@ -4,6 +4,7 @@ #pragma once +#include <filesystem> #include <optional> #include <string> #include <tuple> @@ -108,19 +109,19 @@ private: bool EnsureDirectories() const; /// Gets current game's transferable file path - std::string GetTransferablePath() const; + std::filesystem::path GetTransferablePath() const; /// Gets current game's precompiled file path - std::string GetPrecompiledPath() const; + std::filesystem::path GetPrecompiledPath() const; /// Get user's transferable directory path - std::string GetTransferableDir() const; + std::filesystem::path GetTransferableDir() const; /// Get user's precompiled directory path - std::string GetPrecompiledDir() const; + std::filesystem::path GetPrecompiledDir() const; /// Get user's shader directory path - std::string GetBaseDir() const; + std::filesystem::path GetBaseDir() const; /// Get current game's title id std::string GetTitleID() const; diff --git a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp index 7a9d00d4f..f0ee76519 100644 --- a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp +++ b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp @@ -5,6 +5,7 @@ #ifdef HAS_NSIGHT_AFTERMATH #include <mutex> +#include <span> #include <string> #include <string_view> #include <utility> @@ -12,9 +13,10 @@ #include <fmt/format.h> -#include "common/common_paths.h" #include "common/common_types.h" -#include "common/file_util.h" +#include "common/fs/file.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h" #include "common/logging/log.h" #include "common/scope_exit.h" #include "video_core/vulkan_common/nsight_aftermath_tracker.h" @@ -46,9 +48,9 @@ NsightAftermathTracker::NsightAftermathTracker() { LOG_ERROR(Render_Vulkan, "Failed to load Nsight Aftermath function pointers"); return; } - dump_dir = Common::FS::GetUserPath(Common::FS::UserPath::LogDir) + "gpucrash"; + dump_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::LogDir) / "gpucrash"; - void(Common::FS::DeleteDirRecursively(dump_dir)); + void(Common::FS::RemoveDirRecursively(dump_dir)); if (!Common::FS::CreateDir(dump_dir)) { LOG_ERROR(Render_Vulkan, "Failed to create Nsight Aftermath dump directory"); return; @@ -60,7 +62,8 @@ NsightAftermathTracker::NsightAftermathTracker() { LOG_ERROR(Render_Vulkan, "GFSDK_Aftermath_EnableGpuCrashDumps failed"); return; } - LOG_INFO(Render_Vulkan, "Nsight Aftermath dump directory is \"{}\"", dump_dir); + LOG_INFO(Render_Vulkan, "Nsight Aftermath dump directory is \"{}\"", + Common::FS::PathToUTF8String(dump_dir)); initialized = true; } @@ -89,12 +92,15 @@ void NsightAftermathTracker::SaveShader(const std::vector<u32>& spirv) const { return; } - Common::FS::IOFile file(fmt::format("{}/source_{:016x}.spv", dump_dir, hash.hash), "wb"); + const auto shader_file = dump_dir / fmt::format("source_{:016x}.spv", hash.hash); + + Common::FS::IOFile file{shader_file, Common::FS::FileAccessMode::Write, + Common::FS::FileType::BinaryFile}; if (!file.IsOpen()) { LOG_ERROR(Render_Vulkan, "Failed to dump SPIR-V module with hash={:016x}", hash.hash); return; } - if (file.WriteArray(spirv.data(), spirv.size()) != spirv.size()) { + if (file.Write(spirv) != spirv.size()) { LOG_ERROR(Render_Vulkan, "Failed to write SPIR-V module with hash={:016x}", hash.hash); return; } @@ -129,22 +135,24 @@ void NsightAftermathTracker::OnGpuCrashDumpCallback(const void* gpu_crash_dump, return; } - const std::string base_name = [this] { + std::filesystem::path base_name = [this] { const int id = dump_id++; if (id == 0) { - return fmt::format("{}/crash.nv-gpudmp", dump_dir); + return dump_dir / "crash.nv-gpudmp"; } else { - return fmt::format("{}/crash_{}.nv-gpudmp", dump_dir, id); + return dump_dir / fmt::format("crash_{}.nv-gpudmp", id); } }(); std::string_view dump_view(static_cast<const char*>(gpu_crash_dump), gpu_crash_dump_size); - if (Common::FS::WriteStringToFile(false, base_name, dump_view) != gpu_crash_dump_size) { + if (Common::FS::WriteStringToFile(base_name, Common::FS::FileType::BinaryFile, dump_view) != + gpu_crash_dump_size) { LOG_ERROR(Render_Vulkan, "Failed to write dump file"); return; } const std::string_view json_view(json.data(), json.size()); - if (Common::FS::WriteStringToFile(true, base_name + ".json", json_view) != json.size()) { + if (Common::FS::WriteStringToFile(base_name.concat(".json"), Common::FS::FileType::TextFile, + json_view) != json.size()) { LOG_ERROR(Render_Vulkan, "Failed to write JSON"); return; } @@ -161,16 +169,17 @@ void NsightAftermathTracker::OnShaderDebugInfoCallback(const void* shader_debug_ return; } - const std::string path = - fmt::format("{}/shader_{:016x}{:016x}.nvdbg", dump_dir, identifier.id[0], identifier.id[1]); - Common::FS::IOFile file(path, "wb"); + const auto path = + dump_dir / fmt::format("shader_{:016x}{:016x}.nvdbg", identifier.id[0], identifier.id[1]); + Common::FS::IOFile file{path, Common::FS::FileAccessMode::Write, + Common::FS::FileType::BinaryFile}; if (!file.IsOpen()) { - LOG_ERROR(Render_Vulkan, "Failed to create file {}", path); + LOG_ERROR(Render_Vulkan, "Failed to create file {}", Common::FS::PathToUTF8String(path)); return; } - if (file.WriteBytes(static_cast<const u8*>(shader_debug_info), shader_debug_info_size) != - shader_debug_info_size) { - LOG_ERROR(Render_Vulkan, "Failed to write file {}", path); + if (file.WriteSpan(std::span(static_cast<const u8*>(shader_debug_info), + shader_debug_info_size)) != shader_debug_info_size) { + LOG_ERROR(Render_Vulkan, "Failed to write file {}", Common::FS::PathToUTF8String(path)); return; } } diff --git a/src/video_core/vulkan_common/nsight_aftermath_tracker.h b/src/video_core/vulkan_common/nsight_aftermath_tracker.h index 1ce8d4e8e..4fe2b14d9 100644 --- a/src/video_core/vulkan_common/nsight_aftermath_tracker.h +++ b/src/video_core/vulkan_common/nsight_aftermath_tracker.h @@ -4,6 +4,7 @@ #pragma once +#include <filesystem> #include <mutex> #include <string> #include <vector> @@ -54,7 +55,7 @@ private: mutable std::mutex mutex; - std::string dump_dir; + std::filesystem::path dump_dir; int dump_id = 0; bool initialized = false; diff --git a/src/video_core/vulkan_common/vulkan_library.cpp b/src/video_core/vulkan_common/vulkan_library.cpp index 557871d81..22833fa56 100644 --- a/src/video_core/vulkan_common/vulkan_library.cpp +++ b/src/video_core/vulkan_common/vulkan_library.cpp @@ -6,7 +6,7 @@ #include <string> #include "common/dynamic_library.h" -#include "common/file_util.h" +#include "common/fs/path_util.h" #include "video_core/vulkan_common/vulkan_library.h" namespace Vulkan { @@ -18,9 +18,9 @@ Common::DynamicLibrary OpenLibrary() { char* const libvulkan_env = std::getenv("LIBVULKAN_PATH"); if (!libvulkan_env || !library.Open(libvulkan_env)) { // Use the libvulkan.dylib from the application bundle. - const std::string filename = - Common::FS::GetBundleDirectory() + "/Contents/Frameworks/libvulkan.dylib"; - void(library.Open(filename.c_str())); + const auto filename = + Common::FS::GetBundleDirectory() / "Contents/Frameworks/libvulkan.dylib"; + void(library.Open(Common::FS::PathToUTF8String(filename).c_str())); } #else std::string filename = Common::DynamicLibrary::GetVersionedFilename("vulkan", 1); |