nvidia_flags.cpp 860 B

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