protonscr

[D3D11] deadlock when releasing state object in ID3DDestructionNotifier callback

dxvkclosed
doitsujin/dxvk#5585 · opened 2026-04-17 by kstuedem · updated 2026-04-17 · 3 comments · github
Kkstuedem 2026-04-17 github

Hi, in Luma Framework mods we use ID3DDestructionNotifier (hooked through ReShade) to release modified sampler states derived from the games original ones. With newer Proton versions this leads modded Persona 5 Royal to freeze shortly after launching.

I also created a minimal reproducible example: https://gist.github.com/kstuedem/c9f98f28c5a209f2496c72f23f13169c

Software information

example code / Persona 5 Royal with Luma Framework mod

System information

Apitrace file(s)

ConsoleApplication1.zip

Ddoitsujin maintainer 2026-04-17 github

Urgh, yeah, I see what the problem is and this is exactly why I hate callback-based APIs with a passion. Needs a bit of a think since just changing one of the mutexes to be recursive doesn't fix the problem that ID3DDestructionNotifier currently makes an unordered_map::erase essentially reentrant and I kind of want to avoid wrapping all state objects in even more layers of memory allocation since the runtime cost isn't exactly trivial in some cases.

Edit: Seems like it's actually to avoid extra allocations for all state objects, sigh.

FFiloppi 2026-04-17 github

make sure creating a new object works in the callback too, not just destroying other ones. I'm assuming that'd work on native DX. Luma might just do anything if it can :D

Kkstuedem 2026-04-17 github

That was quick. Can confirm that it fixes the freeze in Persona 5. Thanks! Creation also works @Filoppi.

Nothing extracted yet.