Skip to content

[d3d8/9] Adjust invalid viewport handling#5179

Merged
K0bin merged 2 commits intodoitsujin:masterfrom
WinterSnowfall:d3d9-viewport
Sep 7, 2025
Merged

[d3d8/9] Adjust invalid viewport handling#5179
K0bin merged 2 commits intodoitsujin:masterfrom
WinterSnowfall:d3d9-viewport

Conversation

@WinterSnowfall
Copy link
Contributor

Using a NULL pViewport in SetViewport() will crash the native runtime, but we should handle it a bit more gracefully and not dereference it in that case.

More interestingly, neither d3d8 or 9 will allow the viewport MaxZ to be smaller than or equal to MinZ, and will automatically set MaxZ to MinZ + 0.001f if that's the case.

Drafting until it's confirmed to behave the same on modern OSes, though I don't think there will be any surprises there.

@WinterSnowfall
Copy link
Contributor Author

Confirmed to behave the same on modern Windows, thanks to @Blisto91.

@WinterSnowfall WinterSnowfall marked this pull request as ready for review August 31, 2025 17:08
@WinterSnowfall
Copy link
Contributor Author

WinterSnowfall commented Sep 7, 2025

Squeezed in a minor behavior correction due to an incomplete test. CheckDeviceMultiSampleType will only D3D_OK D3DMULTISAMPLE_NONE checks on NULL format, and will still return D3DERR_NOTAVAILABLE for anything else. Narrows down the behavior introduced in #5039.

@K0bin K0bin merged commit 07084e1 into doitsujin:master Sep 7, 2025
4 checks passed
@WinterSnowfall WinterSnowfall deleted the d3d9-viewport branch September 7, 2025 14:41
Digger1955 added a commit to Digger1955/dxvk-gplasync-lowlatency that referenced this pull request Sep 13, 2025
[71ed2e6](doitsujin@71ed2e6) - [d3d8/9] Adjust invalid viewport handling - [[d3d8/9] Adjust invalid viewport handling](doitsujin#5179)
Digger1955 added a commit to Digger1955/dxvk-gplasync-lowlatency that referenced this pull request Sep 13, 2025
[71ed2e6](doitsujin@71ed2e6) - [d3d8/9] Adjust invalid viewport handling - [[d3d8/9] Adjust invalid viewport handling](doitsujin#5179)
Digger1955 added a commit to Digger1955/dxvk-gplasync-lowlatency that referenced this pull request Sep 13, 2025
[07084e1](doitsujin@07084e1) - [d3d9] Only D3D_OK D3DMULTISAMPLE_NONE checks for NULL format - [[d3d8/9] Adjust invalid viewport handling](doitsujin#5179)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants