Always prioritise loading a new d3dcompiler over re-using an old one

* Previously when replaying we'd always use our d3dcompiler_47.dll that we ship,
  but during capture we would always prioritise re-using an existing d3dcompiler
  that the process already had.
* Since it should be safe to have multiple (differently named) d3dcompiler's in
  the same process and we want to avoid using an old out of date d3dcompiler if
  possible, we prioritise loading a new d3dcompiler_47.dll over re-using an
  existing in-process d3dcompiler_43.dll
This commit is contained in:
baldurk
2025-01-17 15:43:51 +00:00
parent a3a5f07a7e
commit fa2085860d
+11 -12
View File
@@ -58,20 +58,19 @@ HMODULE GetD3DCompiler()
"d3dcompiler_44.dll", "d3dcompiler_43.dll",
};
for(int i = 0; i < 2; i++)
for(int d = 0; d < ARRAY_COUNT(dlls); d++)
{
for(int d = 0; d < ARRAY_COUNT(dlls); d++)
{
// first time around, try to load one that already exists. Second time around try to load it
// in the default search path.
if(i == 0)
ret = GetModuleHandleA(dlls[d]);
else
ret = LoadLibraryA(dlls[d]);
// first attempt try to load one that already exists. Second time around try to load it
// in the default search path.
ret = GetModuleHandleA(dlls[d]);
if(ret != NULL)
return ret;
}
if(ret != NULL)
return ret;
ret = LoadLibraryA(dlls[d]);
if(ret != NULL)
return ret;
}
// finally if we couldn't load a library anywhere from the system while capturing, load our local