From b055c2daea4c8642cb44a35bc137ca36846795fc Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 24 Oct 2022 17:58:57 +0200 Subject: [PATCH] [d3d11] Avoid querying environment variables on shader creation --- src/d3d11/d3d11_options.cpp | 3 +++ src/d3d11/d3d11_options.h | 3 +++ src/d3d11/d3d11_shader.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/d3d11/d3d11_options.cpp b/src/d3d11/d3d11_options.cpp index 6a3f371cc..1d2997122 100644 --- a/src/d3d11/d3d11_options.cpp +++ b/src/d3d11/d3d11_options.cpp @@ -67,6 +67,9 @@ namespace dxvk { } } } + + // Shader dump path is only available via an environment variable + this->shaderDumpPath = env::getEnvVar("DXVK_SHADER_DUMP_PATH"); } } \ No newline at end of file diff --git a/src/d3d11/d3d11_options.h b/src/d3d11/d3d11_options.h index 594580200..e9431538c 100644 --- a/src/d3d11/d3d11_options.h +++ b/src/d3d11/d3d11_options.h @@ -116,6 +116,9 @@ namespace dxvk { /// useful for debugging purposes or when applications have /// race conditions. bool enableContextLock; + + /// Shader dump path + std::string shaderDumpPath; }; } \ No newline at end of file diff --git a/src/d3d11/d3d11_shader.cpp b/src/d3d11/d3d11_shader.cpp index c153c8397..3d6a0642d 100644 --- a/src/d3d11/d3d11_shader.cpp +++ b/src/d3d11/d3d11_shader.cpp @@ -24,7 +24,7 @@ namespace dxvk { // If requested by the user, dump both the raw DXBC // shader and the compiled SPIR-V module to a file. - const std::string dumpPath = env::getEnvVar("DXVK_SHADER_DUMP_PATH"); + const std::string& dumpPath = pDevice->GetOptions()->shaderDumpPath; if (dumpPath.size() != 0) { reader.store(std::ofstream(str::topath(str::format(dumpPath, "/", name, ".dxbc").c_str()).c_str(),