You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WrongGPU-RR.asi crashes with msvcp140.dll older than 14.40 (constexpr std::mutex, _Mtx_lock null read) #9
WrongGPU-RR.asi crashes when the C++ runtime (msvcp140.dll) is older than 14.40:
Loaded with OptiScaler's dxgi.dll (plugins/WrongGPU-RR.asi), the game aborts at start: "dxgi.dll" failed to initialize, aborting, c0000005.
Loaded late (plugins/WrongGPU-RR-loadlate.asi), the game freezes about 30 s in, right after OptiScaler logs Loaded late.
Both are one fault, a null read at MSVCP140+0x12EB0 inside _Mtx_lock. Backtrace: MSVCP140+0x12EB0 <- WrongGPU-RR.asi+0xE980 <- +0x3255E <- +0x1A0EF (InitializeASI) <- dxgi.dll (OptiScaler).
Cause:
The plugin is built with /MD (clean/rr_f/proxy/tools/build.py, CLFLAGS) and linker 14.51.
Since VS 2022 17.10, std::mutex is constant-initialised and needs msvcp140.dll 14.40 or newer. The plugin imports _Mtx_lock and _Mtx_unlock but not _Mtx_init_in_situ. OptiScaler's dxgi.dll does import it, and works.
Cyberpunk's Proton prefix has msvcp140.dll 14.28.29334. The first lock is probably g_log_mutex in log_line(), from InitializeASI. No wronggpu-rr.log is ever written.
The freeze is the game's crash reporter: after the fault on OptiScaler's thread, it suspends every thread for its dump and never resumes them. The game then sits at 0% CPU.
Suggested fix
Add Microsoft's documented switch /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR to CLFLAGS. Alternatively, build the plugin with the static runtime as the other binaries are. A rebuilt plugin should then import _Mtx_init_in_situ. I could not build it, because that needs MSVC.
Confirmed the other way round: after updating the prefix's VC++ runtime to 14.44 (winetricks vcrun2022), the unchanged 0.6.0 plugin loads and runs. Windows players with an old VC++ 2015-2022 redistributable should hit the same crash.
Game and settings
Game and version: Cyberpunk 2077 (Steam), current build
Upscaler chosen in the game's settings, and its quality mode: DLSS, Quality
Resolution, Ray Reconstruction on or off, its mode: 2560x1440, n/a (the crash happens at start)
Windows version: none. Linux (Nobara), GE-Proton 11-11
OptiScaler: the WrongGPU edition from the launcher (10.0.0-pre1)
Logs
From Wine (WINEDEBUG=+seh): Exception 0xc0000005 EXCEPTION_ACCESS_VIOLATION addr=... info[1]=0 (read of address 0), rax=0. The game's own crash info records the same access violation at 0x0 on OptiScaler's late-load thread.
Activity
RR plugin: build with the static C/C++ runtime (/MT)
Release 0.6.1: version 0.6.1 and its release notes