nvidia_flags.cpp 861 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2021 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <cstdlib>
  5. #include <fmt/format.h>
  6. #include "common/fs/file.h"
  7. #include "common/fs/fs.h"
  8. #include "common/fs/path_util.h"
  9. #include "common/nvidia_flags.h"
  10. namespace Common {
  11. void ConfigureNvidiaEnvironmentFlags() {
  12. #ifdef _WIN32
  13. const auto nvidia_shader_dir =
  14. Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir) / "nvidia";
  15. if (!Common::FS::CreateDirs(nvidia_shader_dir)) {
  16. return;
  17. }
  18. const auto windows_path_string =
  19. Common::FS::PathToUTF8String(nvidia_shader_dir.lexically_normal());
  20. void(_putenv(fmt::format("__GL_SHADER_DISK_CACHE_PATH={}", windows_path_string).c_str()));
  21. void(_putenv("__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1"));
  22. #endif
  23. }
  24. } // namespace Common