1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[d3d9] Avoid querying environment variables on shader creation

This commit is contained in:
Philip Rebohle 2022-10-24 18:01:48 +02:00
parent b055c2daea
commit 494e01b353
6 changed files with 12 additions and 7 deletions

View File

@ -2449,7 +2449,7 @@ namespace dxvk {
m_shader = compiler.compile();
m_isgn = compiler.isgn();
Dump(Key, name);
Dump(pDevice, Key, name);
m_shader->setShaderKey(shaderKey);
pDevice->GetDXVKDevice()->registerShader(m_shader);
@ -2472,15 +2472,15 @@ namespace dxvk {
m_shader = compiler.compile();
m_isgn = compiler.isgn();
Dump(Key, name);
Dump(pDevice, Key, name);
m_shader->setShaderKey(shaderKey);
pDevice->GetDXVKDevice()->registerShader(m_shader);
}
template <typename T>
void D3D9FFShader::Dump(const T& Key, const std::string& Name) {
const std::string dumpPath = env::getEnvVar("DXVK_SHADER_DUMP_PATH");
void D3D9FFShader::Dump(D3D9DeviceEx* pDevice, const T& Key, const std::string& Name) {
const std::string& dumpPath = pDevice->GetOptions()->shaderDumpPath;
if (dumpPath.size() != 0) {
std::ofstream dumpStream(

View File

@ -217,7 +217,7 @@ namespace dxvk {
const D3D9FFShaderKeyFS& Key);
template <typename T>
void Dump(const T& Key, const std::string& Name);
void Dump(D3D9DeviceEx* pDevice, const T& Key, const std::string& Name);
Rc<DxvkShader> GetShader() const {
return m_shader;

View File

@ -86,6 +86,8 @@ namespace dxvk {
&& adapter->matchesDriver(VK_DRIVER_ID_MESA_RADV, 0, 0);
d3d9FloatEmulation = hasMulz ? D3D9FloatEmulation::Strict : D3D9FloatEmulation::Enabled;
}
this->shaderDumpPath = env::getEnvVar("DXVK_SHADER_DUMP_PATH");
}
}

View File

@ -152,6 +152,9 @@ namespace dxvk {
/// How much virtual memory will be used for textures (in MB).
int32_t textureMemory;
/// Shader dump path
std::string shaderDumpPath;
};
}

View File

@ -23,7 +23,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) {
DxsoReader reader(

View File

@ -322,7 +322,7 @@ namespace dxvk {
shader->setShaderKey(key);
pDevice->GetDXVKDevice()->registerShader(shader);
const std::string dumpPath = env::getEnvVar("DXVK_SHADER_DUMP_PATH");
const std::string& dumpPath = pDevice->GetOptions()->shaderDumpPath;
if (dumpPath.size() != 0) {
std::ofstream dumpStream(