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

[d3d8] Adjust d3d8 device capabilities #163

Merged
merged 1 commit into from
Jul 4, 2023

Conversation

WinterSnowfall
Copy link

@WinterSnowfall WinterSnowfall commented May 22, 2023

There's no VS Version 1.4, specs say it caps out at 1.1 and this is also what WineD3D reports. Not sure if it affects anything, but we should report it correctly anyway.

Also exposed D3DPRASTERCAPS_ZBIAS which is not included in d3d9, but is present in d3d8 and should be flagged as supported. This (namely its absence) is apparently what was causing the Squad Shadows related crash in Star Wars: Republic Commando. Fixes #41.

P.S. Also added some tests for the above and more in d8vk-tests.

@WinterSnowfall WinterSnowfall force-pushed the d8vk-devicecaps branch 2 times, most recently from 4a5687b to d0aefcb Compare May 23, 2023 11:51
@WinterSnowfall
Copy link
Author

WinterSnowfall commented May 23, 2023

In addition to the above, I have also gone through all the capability flags exposed by d9vk which are not part of the d3d8 spec (or header files) and removed those for safe measure. I don't think any app should be affected by them, as they are set on higher bit ranges in the corresponding DWORDs, but we are now advertising things more like a native d3d8 layer anyway.

Whatever was d3d8 exclusive or otherwise relevant, I have documented in #164.

@WinterSnowfall
Copy link
Author

D3DPRASTERCAPS_ZBIAS is apparently required by UE2.x titles in order to enable character shadows, we just hadn't noticed it. UT2004 shadows are now rendered with this PR.

@LukeShortCloud
Copy link

I downloaded and tried the build artifacts from the GitHub Actions workflow. I can now also confirm that character shadows finally work in Unreal Tournament 2004 with this patch. :-)

@WinterSnowfall
Copy link
Author

Wrote a test to for the d3d9 specific capabilities I have removed.

Here are the results for WineD3D:

Testing for the absence of D3D9 device capabilities flags:
  - D3DCAPS2_CANAUTOGENMIPMAP is not supported
  - D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION is not supported
  - D3DCAPS3_COPY_TO_VIDMEM is not supported
  - D3DCAPS3_COPY_TO_SYSTEMMEM is not supported
  - D3DPMISCCAPS_INDEPENDENTWRITEMASKS is not supported
  - D3DPMISCCAPS_PERSTAGECONSTANT is not supported
  - D3DPMISCCAPS_FOGANDSPECULARALPHA is not supported
  - D3DPMISCCAPS_SEPARATEALPHABLEND is not supported
  - D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS is not supported
  - D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING is not supported
  - D3DPMISCCAPS_FOGVERTEXCLAMPED is not supported
  - D3DPMISCCAPS_POSTBLENDSRGBCONVERT is not supported
  - D3DPRASTERCAPS_SCISSORTEST is not supported
  - D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS is not supported
  - D3DPRASTERCAPS_DEPTHBIAS is not supported
  - D3DPRASTERCAPS_MULTISAMPLE_TOGGLE is not supported
  - D3DPBLENDCAPS_INVSRCCOLOR2 is not supported
  - D3DPBLENDCAPS_SRCCOLOR2 is not supported
  - D3DLINECAPS_ANTIALIAS is not supported
  - D3DSTENCILCAPS_TWOSIDED is not supported
Result: PASSED

@Blisto91 will soon share the output on native AMD.

@WinterSnowfall
Copy link
Author

Well, this is certainly interesting...

Testing for the absence of D3D9 device capabilities flags:
  - D3DCAPS2_CANAUTOGENMIPMAP is not supported
  + D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION is supported
  - D3DCAPS3_COPY_TO_VIDMEM is not supported
  - D3DCAPS3_COPY_TO_SYSTEMMEM is not supported
  - D3DPMISCCAPS_INDEPENDENTWRITEMASKS is not supported
  + D3DPMISCCAPS_PERSTAGECONSTANT is supported
  + D3DPMISCCAPS_FOGANDSPECULARALPHA is supported
  + D3DPMISCCAPS_SEPARATEALPHABLEND is supported
  + D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS is supported
  + D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING is supported
  + D3DPMISCCAPS_FOGVERTEXCLAMPED is supported
  + D3DPMISCCAPS_POSTBLENDSRGBCONVERT is supported
  - D3DPRASTERCAPS_SCISSORTEST is not supported
  - D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS is not supported
  + D3DPRASTERCAPS_DEPTHBIAS is supported
  + D3DPRASTERCAPS_MULTISAMPLE_TOGGLE is supported
  - D3DPBLENDCAPS_INVSRCCOLOR2 is not supported
  - D3DPBLENDCAPS_SRCCOLOR2 is not supported
  - D3DLINECAPS_ANTIALIAS is not supported
  - D3DSTENCILCAPS_TWOSIDED is not supported
Result: FAILED

Native AMD does report a few, including D3DPRASTERCAPS_DEPTHBIAS, which is obviously wrong, since its direct D3D8 corespondent is D3DPRASTERCAPS_ZBIAS...

@AlpyneDreams
Copy link
Owner

Intel:

Testing for the absence of D3D9 device capabilities flags:
  - D3DCAPS2_CANAUTOGENMIPMAP is not supported
  + D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION is supported
  - D3DCAPS3_COPY_TO_VIDMEM is not supported
  - D3DCAPS3_COPY_TO_SYSTEMMEM is not supported
  - D3DPMISCCAPS_INDEPENDENTWRITEMASKS is not supported
  - D3DPMISCCAPS_PERSTAGECONSTANT is not supported
  - D3DPMISCCAPS_FOGANDSPECULARALPHA is not supported
  - D3DPMISCCAPS_SEPARATEALPHABLEND is not supported
  - D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS is not supported
  - D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING is not supported
  - D3DPMISCCAPS_FOGVERTEXCLAMPED is not supported
  - D3DPMISCCAPS_POSTBLENDSRGBCONVERT is not supported
  - D3DPRASTERCAPS_SCISSORTEST is not supported
  - D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS is not supported
  - D3DPRASTERCAPS_DEPTHBIAS is not supported
  - D3DPRASTERCAPS_MULTISAMPLE_TOGGLE is not supported
  - D3DPBLENDCAPS_INVSRCCOLOR2 is not supported
  - D3DPBLENDCAPS_SRCCOLOR2 is not supported
  - D3DLINECAPS_ANTIALIAS is not supported
  - D3DSTENCILCAPS_TWOSIDED is not supported
Result: FAILED

NVIDIA:

Testing for the absence of D3D9 device capabilities flags:
  - D3DCAPS2_CANAUTOGENMIPMAP is not supported
  - D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION is not supported
  - D3DCAPS3_COPY_TO_VIDMEM is not supported
  - D3DCAPS3_COPY_TO_SYSTEMMEM is not supported
  - D3DPMISCCAPS_INDEPENDENTWRITEMASKS is not supported
  - D3DPMISCCAPS_PERSTAGECONSTANT is not supported
  - D3DPMISCCAPS_FOGANDSPECULARALPHA is not supported
  - D3DPMISCCAPS_SEPARATEALPHABLEND is not supported
  - D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS is not supported
  - D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING is not supported
  - D3DPMISCCAPS_FOGVERTEXCLAMPED is not supported
  - D3DPMISCCAPS_POSTBLENDSRGBCONVERT is not supported
  - D3DPRASTERCAPS_SCISSORTEST is not supported
  - D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS is not supported
  - D3DPRASTERCAPS_DEPTHBIAS is not supported
  - D3DPRASTERCAPS_MULTISAMPLE_TOGGLE is not supported
  - D3DPBLENDCAPS_INVSRCCOLOR2 is not supported
  - D3DPBLENDCAPS_SRCCOLOR2 is not supported
  - D3DLINECAPS_ANTIALIAS is not supported
  - D3DSTENCILCAPS_TWOSIDED is not supported
Result: PASSED

@AlpyneDreams AlpyneDreams merged commit 6988ef0 into AlpyneDreams:main Jul 4, 2023
2 of 3 checks passed
@WinterSnowfall WinterSnowfall deleted the d8vk-devicecaps branch July 4, 2023 22:33
@WinterSnowfall WinterSnowfall mentioned this pull request Sep 23, 2023
3 tasks
@mirh
Copy link

mirh commented Sep 23, 2023

CardCaps.xls
These are the legit capabilities from back in the days, if you were wondering..

EDIT: @cdragan do you have any plaintext/database/table from your old d3dcaps website? It's the only place I found with dx8-api info

@cdragan
Copy link

cdragan commented Sep 24, 2023

Hi @mirh, unfortunately that database died many years ago when I lost access to the server on which the website was hosted. You are probably aware that there's an excellent website now gpuinfo.org, unfortunately it does not host information about D3D.

@WinterSnowfall
Copy link
Author

CardCaps.xls These are the legit capabilities from back in the days, if you were wondering..

Thanks for sharing it. While it's interesting for historical purposes, the relevant thing to consider today is what native drivers are (still) reporting, and we have tests for that.

@mirh
Copy link

mirh commented Sep 25, 2023

Native drivers today may actually report different things from native drivers 20 years ago, let alone that there's the ever looming XP-Vista boundary to consider.
With splinter cell issues specifically, we actually even know both variables kinda apply: no WDDM driver ever worked, and even the XDDM ones broke after 175.80. (there's also reports of ati cards managing to have some "still half-decent intermediate result" but idk)

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.

SW: Republic Commando crashes on game start when squad shadows are enabled
5 participants