summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-01-27 20:34:21 +0100
committerGitHub <noreply@github.com>2021-01-27 20:34:21 +0100
commit28b822fe381164f0c2d426b4c6e5866a69bb9fa4 (patch)
treeda84c060ce3f9411423485d5409ca96b1e366aa2 /src/common
parentMerge pull request #5812 from german77/StubSixaxisFusion (diff)
parentrenderer_opengl: Avoid precompiled cache and force NV GL cache directory (diff)
downloadyuzu-28b822fe381164f0c2d426b4c6e5866a69bb9fa4.tar
yuzu-28b822fe381164f0c2d426b4c6e5866a69bb9fa4.tar.gz
yuzu-28b822fe381164f0c2d426b4c6e5866a69bb9fa4.tar.bz2
yuzu-28b822fe381164f0c2d426b4c6e5866a69bb9fa4.tar.lz
yuzu-28b822fe381164f0c2d426b4c6e5866a69bb9fa4.tar.xz
yuzu-28b822fe381164f0c2d426b4c6e5866a69bb9fa4.tar.zst
yuzu-28b822fe381164f0c2d426b4c6e5866a69bb9fa4.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/CMakeLists.txt2
-rw-r--r--src/common/nvidia_flags.cpp27
-rw-r--r--src/common/nvidia_flags.h10
3 files changed, 39 insertions, 0 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index f77575a00..bfd11e76d 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -138,6 +138,8 @@ add_library(common STATIC
microprofile.h
microprofileui.h
misc.cpp
+ nvidia_flags.cpp
+ nvidia_flags.h
page_table.cpp
page_table.h
param_package.cpp
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
diff --git a/src/common/nvidia_flags.h b/src/common/nvidia_flags.h
new file mode 100644
index 000000000..75a0233ac
--- /dev/null
+++ b/src/common/nvidia_flags.h
@@ -0,0 +1,10 @@
+// Copyright 2021 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+namespace Common {
+
+/// Configure platform specific flags for Nvidia's driver
+void ConfigureNvidiaEnvironmentFlags();
+
+} // namespace Common