Repository navigation
Stop two threads from hooking the same Metal class - #340
Closed
woahitsraj wants to merge 1 commit into
Closed
woahitsraj wants to merge 1 commit into
woahitsraj wants to merge 1 commit into
Conversation
Owner
|
Nice catch! I'll get this merged for a potential hotfix. |
Owner
|
Merged! |
Contributor
Author
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sometimes Metaphor: ReFantazio opens to a black window with the Steam Overlay on. Two threads both hook
endEncoding. The second saves our hook as the original, so the hook calls itself forever and no frame is submitted.All six
ensure_*_hooksfunctions had the same race, so all six use the lock.Evidence
I sampled a stuck launch on 1.2.8. Two threads were spinning in
hook_end_encoding, and the swap chain thread was inD3DMCommandQueue::WaitUntilSubmission. The log had twoensure_encoder_hookslines.hookracestarts 8 threads on a new class, 2,000 times, and checks that the saved originals aren't our hooks.stage_claimed.make overlay-shim-tests: 12 passed, 0 skipped.I ran the fix on 1.2.8 (the shim source is the same on main), CrossOver 26.3 (Rosetta, D3DMetal), an M4 Max and macOS 27.0.1. Metaphor started each time and the overlay opened. I haven't tested FEX.