mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
overlay: remove dependency on d3dcompiler (#738)
## Link to GitHub Issue or related Pull Request, if one exists Fixes #737, regressed by #707 ## Description of change ImGui backend for DX11 pulled in dependency on a specific version of `d3dcompiler_47.dll` which is not present on stock Win7 OS image. Change this to a runtime load of the DLL and disable the overlay if we can't find one. ## Testing - [x] Win11, DX11 overlay - [x] Win11, DX9 overlay - [x] Win7, DX9 overlay
This commit is contained in:
@@ -213,6 +213,27 @@ void poll_thread() {
|
||||
}
|
||||
}
|
||||
|
||||
// the overlay's imgui dx11 backend needs D3DCompile (d3dcompiler_XX.dll) to
|
||||
// build its shaders. _43 ships with the DX June 2010 redist on stock Win7;
|
||||
// _46/_47 come with newer Windows.
|
||||
bool d3dcompiler_available() {
|
||||
static const wchar_t *names[] = {
|
||||
L"d3dcompiler_47.dll",
|
||||
L"d3dcompiler_46.dll",
|
||||
L"d3dcompiler_43.dll",
|
||||
};
|
||||
for (auto name : names) {
|
||||
HMODULE mod = GetModuleHandleW(name);
|
||||
if (!mod) {
|
||||
mod = LoadLibraryW(name);
|
||||
}
|
||||
if (mod && GetProcAddress(mod, "D3DCompile")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void graphics_d3d11_init() {
|
||||
@@ -223,6 +244,14 @@ void graphics_d3d11_init() {
|
||||
return;
|
||||
}
|
||||
|
||||
// no d3dcompiler -> overlay can't build shaders; skip dx11 overlay
|
||||
if (!d3dcompiler_available()) {
|
||||
log_warning(
|
||||
"graphics::d3d11",
|
||||
"d3dcompiler not found; dx11 overlay disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(g_init_mutex);
|
||||
if (g_poll_thread.joinable()) {
|
||||
return; // already initialized
|
||||
|
||||
Reference in New Issue
Block a user