ValveSoftware / wine

Wine with a bit of extra spice
Other
1.3k stars 244 forks source link

Support VK_NV_low_latency2 #200

Open esullivan-nvidia opened 1 year ago

esullivan-nvidia commented 1 year ago

This PR updates the Vulkan xml file to 1.3.267, and adds some additional support for the VK_NV_low_latency2 extension to winevulkan. The only code changes needed are for passing in a valid frame id to fshack's vkQueueSubmit.

ivyl commented 1 year ago

What is this for? Are there any consumers of this API out there that will benefit from supporting it?

It would be nice to get the Vulkan version bump upstreamed. Save hassle when rebasing the tree.

Also the custom implementation of vkSetLatencySleepModeNV, it looks like it's there for setting the private low_latency_enabled for fshack. Is there any reason why we don't handle passing .sType and .pNext and set them to hardcoded values?

Etaash-mathamsetty commented 1 year ago

What is this for? Are there any consumers of this API out there that will benefit from supporting it?

It would be nice to get the Vulkan version bump upstreamed. Save hassle when rebasing the tree.

Also the custom implementation of vkSetLatencySleepModeNV, it looks like it's there for setting the private low_latency_enabled for fshack. Is there any reason why we don't handle passing .sType and .pNext and set them to hardcoded values?

for the first question, there are PRs on the dxvk and dxvk-nvapi repos to add support for this extension to enable reflex in games, so yes there are consumers

ivyl commented 1 year ago

Linking to the related PRs that those are all cross-linked:

https://github.com/doitsujin/dxvk/pull/3690 https://github.com/HansKristian-Work/vkd3d-proton/pull/1739 https://github.com/jp7677/dxvk-nvapi/pull/147

ivyl commented 1 year ago

Bump to Vulkan 1.3.267 has been cherry-picked from upstream. This unblocks work on other projects - testing that it works when the supporting driver finally drops. Only the fshack remains but it's not essential and we can iterate on it a bit.

ptr1337 commented 9 months ago

@esullivan-nvidia

Could you please update this for the experimental 9 or proton 9 branch? Thanks in advance

Edit: It fails currently with:

touch /tmp/makepkg/proton-cachyos/src/build/.wine-source
cd /tmp/makepkg/proton-cachyos/src/build/src-wine && tools/make_specfiles
dlls/ntdll/ntsyscalls.h updated
dlls/win32u/win32syscalls.h updated
cd /tmp/makepkg/proton-cachyos/src/build/src-wine && tools/make_requests
include/wine/server_protocol.h updated
include/wine/server_protocol.h updated
server/trace.c updated
server/request.h updated
cd /tmp/makepkg/proton-cachyos/src/build/src-wine && dlls/winevulkan/make_vulkan -x vk.xml
Traceback (most recent call last):
  File "/tmp/makepkg/proton-cachyos/src/build/src-wine/dlls/winevulkan/make_vulkan", line 215, in <module>
    "vkSetLatencySleepModeNV" : {"dispatch": True, "driver": False, "thunk" : ThunkType.NONE},
                                                                              ^^^^^^^^^
NameError: name 'ThunkType' is not defined
make[1]: *** [../proton/Makefile.in:451: /tmp/makepkg/proton-cachyos/src/build/.wine-post-source] Error 1
make[1]: Leaving directory '/tmp/makepkg/proton-cachyos/src/build'
make: *** [../proton/Makefile.in:1197: dist] Error 2

Fixing the thunks issue results into:

/tmp/makepkg/proton-cachyos/src/build/src-wine/dlls/winevulkan/vulkan.c: In function ‘wine_vkSetLatencySleepModeNV’:
/tmp/makepkg/proton-cachyos/src/build/src-wine/dlls/winevulkan/vulkan.c:919:68: error: ‘struct wine_device’ has no member named ‘device’
  919 |     return wine_device->funcs.p_vkSetLatencySleepModeNV(wine_device->device, wine_swapchain->swapchain, &sleep_mode_info_host);
      |                                                                    ^~
/tmp/makepkg/proton-cachyos/src/build/src-wine/dlls/winevulkan/vulkan.c:919:94: error: ‘struct wine_swapchain’ has no member named ‘swapchain’; did you mean ‘host_swapchain’?
  919 |     return wine_device->funcs.p_vkSetLatencySleepModeNV(wine_device->device, wine_swapchain->swapchain, &sleep_mode_info_host);
      |                                                                                              ^~~~~~~~~
      |                                                                                              host_swapchain
ptr1337 commented 9 months ago

was able to fix the patch and test against proton 9. Everything is working fine. Here the patch: https://github.com/CachyOS/CachyOS-PKGBUILDS/blob/master/proton-cachyos/proton-cachyos/wine-reflex.patch