Most likely related: https://github.com/AlpyneDreams/d8vk/issues/165
It's also using UE2, and arguably the stuttering is nowhere near as bad as it is in UT2004, but it's there. It's probably more evident in single player.
According to Josh it's mostly down to TexcoordFlags, TransformFlags and TexcoordDeclMask.
This eliminates stutters almost completely, but has rendering artifacts on the HUD:
https://github.com/doitsujin/dxvk/compare/master...netborg-afps:dxvk:2023_06_fixing_ut2004_stutters
Not sure if this is a fix or a hack?
Edit: Seems like I forgot that Vertex Shader and Pixel Shader are part of the Pipeline definition, so this obviously is a hack.
What I also found out is that Pipeline compilation did take at most 0.5 ms in most cases and 30 ms very rarely (OK, that seems to be because of nvidia cache).
Because my previous hack made me confident the game is actually largely stutter-free when moving some variables to the shader, I made a real fix last week. In case someone wants to play UT2004, or any UE2 game via dxvk, the fix is available here:
https://github.com/netborg-afps/dxvk/tree/2023_06_fixing_ut2004_stutters
The disadvantage of the fix though is that vertex shader compile times roughly doubled, so the only true solution which works for all games would be a single uber-shader which wouldn't need to be compiled at runtime.
Still an issue unfortunately :disappointed:
Still an issue unfortunately 😞
Have you tried my fix?
Unfortunately, this won't get into upstream because it slows down other games, but it allows you to play this game largely stutter-free.
@netborg-afps I did and it's better than regular dxvk, but not really a stutter-free experience, especially at the beginning of the game. Other UE2 games like Postal 2 20th anniversary are still a very stuttery experience and basically unplayable :cry:
https://github.com/netborg-afps/dxvk/tree/2023_06_fixing_ut2004_stutters
Prototype branch that turns parts of the FF vertex shader dynamic.
@K0bin I don't see a prototype branch in that repo, is it the display_render_latency branch?
Whoops, lost the branch from my link.
That's the branch I previously tested (and that I use regularly for ut2004). It reduces stuttering a lot in ut but other UE2 games like postal 2 still run quite poorly.
Still an issue unfortunately 😞
Have you tried my fix? Unfortunately, this won't get into upstream because it slows down other games, but it allows you to play this game largely stutter-free.
Could you update your fix to 2.6.1? Thank you.
Could you update your fix to 2.6.1? Thank you.
Done
https://github.com/netborg-afps/dxvk/actions/runs/15097936969
Nothing extracted yet.
Unreal Tournament 2004 (with D3D8to9 or D8VK) suffers from shader compilation stutters.
DXVK generates a lot of fixed function vertex shaders. Additionally the game has a queue sync every frame, which naturally means that we also synchronize with the CS thread. So each shader compilation stalls both threads making it even worse.
A possible solution would be to move our generated fixed function shaders more towards uber-shaders and handle multiple versions in one shader.
Software information
Unreal Tournament 2004
System information
Apitrace file(s)
https://drive.google.com/file/d/1dTbqCiJL8AJESJWZZsJNliCZvV0tc4Cl/view?usp=sharing
Log files
I made it print out the 4 uint32_t words of the FF VS key.
shader_compilation_log.txt