aboutsummaryrefslogtreecommitdiff
path: root/src/common/nvidia_flags.cpp
blob: d537517db9d5f00c216c2be3248e8ef3299674e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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