Open Mashaaaaaaaaaaa opened 2 years ago
Your apitrace is ~2 seconds of ingame frames and 30s of loading screens. That's not a lot to go off.
Something that's definitely noticable though: it creeps up to 12GB of VRAM. Pretty sure the 3070 only has 8, so it resorts to putting a lot of resources into regular system memory which can completely destroy performance in some cases. A lot of newer AMD GPUs have 16GB of VRAM, so I can definitely see why this would be less of an issue on those.
I strongly suspect this is a game bug. It creates a LOT of textures and never frees them.
According to protondb, the game is reportedly perfectly playable on the steam deck and on various older or weaker GPU's than my 3070, so I'm not sure this is a full explanation.
AMD GPUs also have better memory management on Linux than Nvidia ones.
Oh wow, I tried turning down the texture quality from high to medium and my FPS in the ship editor went from 1 to 70. I guess you were on the money, thank you!
Hehe the VRAM usage is quite insane. Got up to over 11GB when i replayed the trace on my R9 380. And it only has 4GB 😁
The fun part is that it doesn't even use most of the textures.
Yeah I checked the trace in more detail to make sure we're not being stupid, but it really does look like the game just unconditionally loads all of its textures, which amounts to a bit over 11 GiB. DXVK doesn't handle this well at all and it's not something we can easily improve.
This is something that happens with most Unity Games. Slime Rancher has the same problem if you set the textures to the max value, the FPS just tanks to unplayable values. Also the same happens with Syberia: The World Before. All of these games are Unity, so, i'm guessing it's Unity causing these problems.
@Mashaaaaaaaaaaa I see the latest update includes some changes to VRAM management and allows texture streaming. https://store.steampowered.com/news/app/1176470/view/3389548848346863204 Does this improve the issue? Dunno if it's on by default or needs to be enabled.
It needs to be enabled. I did notice moderate performance increase at medium texture quality but setting it to high seemed to have the same performance drop as before.
@Mashaaaaaaaaaaa Are you around to give this another go with dxvk master?
@Mashaaaaaaaaaaa Double friendly ping
Terra Invicta has an issue where opening the ship designer once it is unlocked or generally doing anything ship-related (looking at a ship in space, engaging in space combat, etc.) makes the FPS drops into the 1-2 range, with the issue sometimes resolving itself afterwards, but often persisting until a save+reload, which makes the game nearly-unplayable in the lategame as reloads take several minutes.
As far as I can tell, people with AMD GPU's report the game running flawlessly on their systems, so the issue seems Nvidia-specific.
My testing with Proton-GE showed that PROTON_USE_WINED3D=1 significantly mitigates the performance issues, but is not a full solution due to introducing severe instability problems, thus the performance issues seem DXVK-specific.
Software information
Terra Invicta, playing with the maximum graphics settings.
System information
Apitrace file(s)
The apitrace had to be performed with DXVK, contrary to the instructions, because the issue is not reproducible under WineD3D. The issue reproduction consisted of me launching the game, loading a savegame where I had access to the ship designer, opening the ship designer, putting one module on a ship, and closing the ship designer, then closing the game several seconds later. Luckily, in this reproduction attempt, the lags went away after this, so the trace should consist of a long and slow loading, followed by a few seconds of decent FPS, then the 1-2 FPS period with the issue, then decent FPS again, which should make it relatively easy to isolate. Link: https://drive.google.com/file/d/1cigeHmsXYq-ZNXeffG9bXgRJp0fiH26f/view?usp=sharing
Log files
They were generated with DXVK_LOG_LEVEL=debug DXVK_HUD=full during the same run which created the apitrace.