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] GetInfo rework & a couple of CopyRects validation tweaks #4296

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

WinterSnowfall
Copy link
Contributor

@WinterSnowfall WinterSnowfall commented Sep 26, 2024

I've reworked our implementation of GetInfo() to more closely follow what d9vk is doing, namely:

  • pQuery->Issue() will never fail in d9vk (and even if can fail according to spec, we shouldn't care much, as pQuery->GetData() would also then fail).
  • D3DDEVINFOID_RESOURCEMANAGER and D3DDEVINFOID_VERTEXSTATS, though technically supported by d3d8 are not implemented in d9vk. D3D9's CreateQuery() will always return D3DERR_NOTAVAILABLE for both as it stands, thus we shouldn't really speculate on the outcome (removed the "unlikely" hint).
  • According to specs, D3D9 GetData() should always be called with D3DGETDATA_FLUSH for the queries that D3D8 supports.
  • D3D9 GetData() returns are inline with what GetInfo() should return if it reaches that point.

The above allows us to get rid of the goto and restructure the flow a bit.

Also as part of this PR I've changed some CopyRects behavior:

  • removed format difference check from copyTextureBuffers, since this is now done globally on CopyRects calls, as per spec.
  • CopyRects depth stencil checks are done after the format difference checks, so there's no need to check both src and dest.

@WinterSnowfall
Copy link
Contributor Author

WinterSnowfall commented Sep 26, 2024

Fixed a couple of other things I stumbled into:

  • We were creating an invalid auto depth stencil in cases where the D3D9 device was created with the EnableAutoDepthStencil present param flag set to FALSE. The stencil surface would cause a crash in these cases on any direct calls, such as GetDesc(). Keeping it as nullptr is pretty much the correct behavior here, since if the application doesn't set a depth stencil, the runtime doesn't generate one.
  • I honestly don't see how it's possible to create a depth stencil with D3DFMT_UNKNOWN as everything validates that away, however using D32 was incorrect, because it's technically unsupported. Replaced it with D24X8, although I don't think it's actually going to end up used anyway.

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.

1 participant