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

Fix crash when srv is submitted to ClearUnorderedAccessViewUint #3734

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

canadacow
Copy link
Contributor

The Settlers: New Allies, crashes on launch due to the fact that it tries to submit an SRV to clearance via ClearUnorderedAccessViewUint.

The native behavior is to ignore the errant resource type (see attached repro of the behavior) but dxvk, due to a static cast, crashes when it references the mis-cast object. This change does a QI and confirms the correct object before use, returning immediately if it is not.

D3D11SrvClearTest.cpp

…ccessViewUint. The static_cast in the function does not translate correctly and crashes.

Native D3D11 behavior is to ignore the bad parameter entirely. It does not clear the SRV nor does it fault or even error with the DEBUG validator.

This QI confirms that it is in fact a UAV that is passed in, emulating the native D3D11 behavior.
@misyltoad
Copy link
Collaborator

Can we do something other than QueryInterface here which involves useless atomic ref-ing? Do we have a base class for views we can grab some type enum from?

Integrate feedback
@canadacow
Copy link
Contributor Author

@Joshua-Ashton , I don't know dxvk well enough to suggest something that would pass muster here. Frankly though, seems like premature optimization when QI is the correct and expected behavior in all other such instances.

@doitsujin
Copy link
Owner

QI is fine, it's not like games call ClearUAV more than a dozen times or so per frame.

My real issue here is that passing an SRV by accident shouldn't even be possible, the parameter is typed after all and only accepts a UAV pointer. The only way this can even happen is if the game deliberately and knowingly casts a non-UAV pointer to UAV.

@doitsujin doitsujin merged commit d4c5fc7 into doitsujin:master Jan 23, 2024
3 checks passed
@canadacow
Copy link
Contributor Author

@doitsujin , completely agreed, which is why I provided the native sample showing the behavior Microsoft has implemented, no doubt earned in blood. :-)

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