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] Do not assume 16-byte alignment in replaceNaN #4448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

doitsujin
Copy link
Owner

Stack alignment is 4 bytes on 32-bit, and we cannot align variables on the stack, so this is technically broken. Use unaligned stores instead even if those are a bit slower.

Stack alignment is 4 bytes on 32-bit, and we cannot align variables
on the stack, so this is technically broken.
@doitsujin doitsujin requested a review from misyltoad November 12, 2024 17:53
@AlpyneDreams
Copy link
Contributor

For what it's worth, I don't remember why I added the alignas in #3547 instead of just making it unaligned like in #3515, but I don't think there was a good reason. It already caused unfathomable anguish during the development of d8vk.

@misyltoad
Copy link
Collaborator

why can variables not be aligned? surely it can just add some and & off the stack ptr?

@doitsujin
Copy link
Owner Author

doitsujin commented Dec 6, 2024

why can variables not be aligned? surely it can just add some and & off the stack ptr?

Ishi explained the issue, something with SEH requiring stack alignment to be done in a specific way but GCC doing it in a different way, so with a Windows target platform, GCC will just not align rsp at all and silently generate code that can explode at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants