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

Current DXVK implementation (as of 2.3.1) seems to trigger SK_DXGI_PresentBase twice per frame #167

Closed
Kethen opened this issue Apr 21, 2024 · 3 comments

Comments

@Kethen
Copy link

Kethen commented Apr 21, 2024

In Wine, when dxvk d3d11.dll+dxgi.dll is installed to c:/windows/system32, SpecialK can still be hooked as local dxgi.dll/d3d11.dll placed next to applications

When loaded that way (SpecialK hooking DXVK d3d11.dll and dxgi.dll), below can be observed:

  1. SpecialK actually hooks correctly, I was interested in the texture modding feature and both dumping and injecting were working
  2. However Performance is degraded
  3. Built in fps counter shows double actual application framerate

While I have not performed any runtime tracing to confirm this, this is likely caused by the fact that dxvk DxgiSwapChain::Present just calls DxgiSwapChain::Present1 with null pPresentParameters, firing both Present and Present1 hooks when an application uses Present

https://github.com/doitsujin/dxvk/blob/2b70ba8f7798107308a0c34358a9e83e77017dfd/src/dxgi/dxgi_swapchain.cpp#L305-L307

Perhaps a config options should be added to skip either DxgiSwapChain::Present1 or DxgiSwapChain::Present hooking/callback?

@Kaldaien
Copy link
Member

Ugh.

I was hoping this issue would never come up. Figures it would be DXVK though.

I think the proper solution would be for SK to call Present1 (...) in its Present (...) hook and never call the original Present function. The reason I haven't done this is because there are some overlays that don't understand Present1. The Steam overlay was like that for many years.

@Kaldaien
Copy link
Member

No wait, nevermind. This isn't fixable. The Steam overlay and RTSS will both crash if Present1 (...) is called.

This is better addressed if you contact the developers of DXVK instead.

Kethen added a commit to Kethen/dxvk that referenced this issue Apr 22, 2024
Kethen added a commit to Kethen/dxvk that referenced this issue Apr 22, 2024
doitsujin pushed a commit to doitsujin/dxvk that referenced this issue Apr 22, 2024
@Kethen
Copy link
Author

Kethen commented Apr 22, 2024

closing for now since doitsujin/dxvk#3966 was merged

while it fixed the double fps stats, it only partially fixed the degraded performance

another cause of degraded performance seems to be related to bool SK_D3D11_EnsureMatchingDevices (ID3D11DeviceChild *pDeviceChild, ID3D11Device *pDevice) and bool SK_D3D11_EnsureMatchingDevices (IDXGISwapChain *pSwapChain, ID3D11Device *pDevice) never matching on dxvk, causing vram/pcie bandwidth issue with imgui_d3d11

will be creating a new issue when I have a better grasp of the other cause(s) of degraded performance

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

No branches or pull requests

2 participants