diff options
author | bunnei <bunneidev@gmail.com> | 2021-01-27 11:34:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-27 11:34:21 -0800 |
commit | 28b822fe381164f0c2d426b4c6e5866a69bb9fa4 (patch) | |
tree | da84c060ce3f9411423485d5409ca96b1e366aa2 /src/common/nvidia_flags.cpp | |
parent | fb0fe3b8c37e9705ed18cb798eda8e144151b1da (diff) | |
parent | 51512d01d8e956b2afada91e51dfd7c0a6444ad6 (diff) |
Merge pull request #5778 from ReinUsesLisp/shader-dir
renderer_opengl: Avoid precompiled cache and force NV GL cache directory
Diffstat (limited to 'src/common/nvidia_flags.cpp')
-rw-r--r-- | src/common/nvidia_flags.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/common/nvidia_flags.cpp b/src/common/nvidia_flags.cpp new file mode 100644 index 000000000..d537517db --- /dev/null +++ b/src/common/nvidia_flags.cpp @@ -0,0 +1,27 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <filesystem> +#include <stdlib.h> + +#include <fmt/format.h> + +#include "common/file_util.h" +#include "common/nvidia_flags.h" + +namespace Common { + +void ConfigureNvidiaEnvironmentFlags() { +#ifdef _WIN32 + const std::string shader_path = Common::FS::SanitizePath( + fmt::format("{}/nvidia/", Common::FS::GetUserPath(Common::FS::UserPath::ShaderDir))); + const std::string windows_path = + Common::FS::SanitizePath(shader_path, Common::FS::DirectorySeparator::BackwardSlash); + void(Common::FS::CreateFullPath(shader_path + '/')); + void(_putenv(fmt::format("__GL_SHADER_DISK_CACHE_PATH={}", windows_path).c_str())); + void(_putenv("__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1")); +#endif +} + +} // namespace Common |