summaryrefslogtreecommitdiffstats
path: root/src/common/nvidia_flags.cpp
blob: c732c233ee396be3798ad0af1268545361cdbcb5 (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
28
29
30
31
32
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#include <cstdlib>

#include <fmt/format.h>

#include "common/fs/fs.h"
#include "common/fs/path_util.h"
#include "common/nvidia_flags.h"

namespace Common {

void ConfigureNvidiaEnvironmentFlags() {
#ifdef _WIN32
    const auto nvidia_shader_dir =
        Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir) / "nvidia";

    if (!Common::FS::CreateDirs(nvidia_shader_dir)) {
        return;
    }

    const auto windows_path_string =
        Common::FS::PathToUTF8String(nvidia_shader_dir.lexically_normal());

    void(_putenv(fmt::format("__GL_SHADER_DISK_CACHE_PATH={}", windows_path_string).c_str()));
    void(_putenv("__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1"));
#endif
}

} // namespace Common