-
Notifications
You must be signed in to change notification settings - Fork 833
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
[d3d8] Implement monotonic state block tokens #4111
Conversation
058d762
to
f1ef863
Compare
I've tested ~140 d3d8 games with this PR and everything checks out. I've only seen one obscure game (FireStarter), at times, passing a state block token to apply a previously deleted state block, which is why I added the validations. Native drivers on Windows XP don't do any validations and would outright crash in this situation. |
f1ef863
to
8445d00
Compare
e1a3e66
to
623a8f4
Compare
Finalized now, hopefully. Thanks for all the nudging in the right directions. |
623a8f4
to
cd6b9b3
Compare
Looks good to me. I don't have permission to merge so one of the maintainers will have to do that. |
Would need feedback from @AlpyneDreams .
The idea is to get rid of reinterpret casts and stick with what native does, namely a monotonically increasing counter that is passed back as the token whenever new state blocks are created. Tests have shown there's no token reuse, not even between device resets.
I also don't think we should worry about the address space being exhausted, because I did some quick math and if let's say a game creates 8 state blocks per frame @ 60 fps, it will take about 100+ days to overflow a DWORD. That's "let's not worry about it" territory in my book... but I can in theory implement a check to see if a token is already taken before allocating it.