diff options
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 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <filesystem> | ||
| 6 | #include <stdlib.h> | ||
| 7 | |||
| 8 | #include <fmt/format.h> | ||
| 9 | |||
| 10 | #include "common/file_util.h" | ||
| 11 | #include "common/nvidia_flags.h" | ||
| 12 | |||
| 13 | namespace Common { | ||
| 14 | |||
| 15 | void ConfigureNvidiaEnvironmentFlags() { | ||
| 16 | #ifdef _WIN32 | ||
| 17 | const std::string shader_path = Common::FS::SanitizePath( | ||
| 18 | fmt::format("{}/nvidia/", Common::FS::GetUserPath(Common::FS::UserPath::ShaderDir))); | ||
| 19 | const std::string windows_path = | ||
| 20 | Common::FS::SanitizePath(shader_path, Common::FS::DirectorySeparator::BackwardSlash); | ||
| 21 | void(Common::FS::CreateFullPath(shader_path + '/')); | ||
| 22 | void(_putenv(fmt::format("__GL_SHADER_DISK_CACHE_PATH={}", windows_path).c_str())); | ||
| 23 | void(_putenv("__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1")); | ||
| 24 | #endif | ||
| 25 | } | ||
| 26 | |||
| 27 | } // namespace Common | ||