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

nvapi: Guard against null device in Reflex calls #170

Merged
merged 2 commits into from
Mar 22, 2024
Merged

nvapi: Guard against null device in Reflex calls #170

merged 2 commits into from
Mar 22, 2024

Conversation

Saancreed
Copy link
Collaborator

@Saancreed Saancreed commented Mar 21, 2024

Fixes a crash in Horizon Forbidden West.

@esullivan-nvidia
Copy link
Contributor

Maybe it would be better to have the Reflex NVAPI entry points return NVAPI_INVALID_ARGUMENT if the device is null?

@Saancreed
Copy link
Collaborator Author

Maybe it would be better to have the Reflex NVAPI entry points return NVAPI_INVALID_ARGUMENT if the device is null?

Yeah, good point. I intend to also check how native NVAPI behaves on Windows here first but something like NVAPI_INVALID_ARGUMENT or NVAPI_INVALID_POINTER sounds likely to be the case.

@Saancreed
Copy link
Collaborator Author

Native Windows NVAPI returns -5 / NVAPI_INVALID_ARGUMENT for NvAPI_D3D_* Reflex entry points accepting device as IUnknown* and -14 / NVAPI_INVALID_POINTER for NvAPI_D3D12_* Reflex entry points accepting ID3D12CommandQueue*. I updated each relevant function to behave like this and added tests to verify this behavior.

I've kept the null check in GetLowLatencyDevice for general robustness, even though it shouldn't be needed anymore. We can probably drop that commit though.

@Saancreed Saancreed marked this pull request as ready for review March 22, 2024 09:40
@Saancreed Saancreed requested a review from jp7677 March 22, 2024 09:40
@jp7677
Copy link
Owner

jp7677 commented Mar 22, 2024

Reference: ValveSoftware/Proton#7590

@jp7677 jp7677 merged commit efcc764 into master Mar 22, 2024
2 checks passed
@Saancreed Saancreed deleted the hfw branch March 22, 2024 10:00
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