Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[d3d9] D3D9DeviceChild refcounts should be clamped on Release() #4615

Open
WinterSnowfall opened this issue Jan 15, 2025 · 0 comments
Open
Labels

Comments

@WinterSnowfall
Copy link
Contributor

WinterSnowfall commented Jan 15, 2025

Calling Release() on D3D9DeviceChild currently causes refcount underruns if an application keeps calling it even after the refcount has reached 0. In some cases (especially due to race conditions) this can cause livelocking, although I expect this to be exceptionally rare if it's even a problem in practice.

In d3d8 land we have encountered a game that depends on this behaving correctly however (without underruning), namely Motor City Online, which is why we've added this bit. While it perhaps isn't fully thread safe, it does solve the underlying problem. I have PRed the same change on d3d9 side in the past but it was deemed to not be an ideal way of handling it.

There is also a WineD3D d3d9 device test centered around device refcounts which currently fails due to our mishandling of the situation.

We should, at some point, fully fix this properly in both d3d8 and d3d9.

@K0bin K0bin added the d3d9 label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants