This seems like a driver issue. I can reproduce with the trace using amdvlk.Q3.1 on linux, which should correspond ish to 23.8.1/23.8.2 on Windows i believe. Using amdvlk.Q3.2 it is fine again so 23.10.2 and above should probably also be fine in regards to this.
Just tried updating to 23.10.2 per your suggestion and the game just crashes at startup with the attached log. Tried running it with 1.10.3, 2.3 and https://github.com/doitsujin/dxvk/commit/ac78048c23c946caf0c734972e880f960080dd62.
TestDrive2_d3d9.log
I am not reproducing a startup crash on Linux with amdvlk (also non newest versions) or radv at least. Testing using a RX 6800
Sorry for the late reply here. I've now tested all available AMD drivers on Linux and couldn't recreate this problem (nor the crash on Windows). Seems like this is a driver issue.
Try again with the newly released AMD driver.
Tried running both TDU and TDU2 with the new driver and both game still crash with err: D3D9SwapChainEx: Failed to recreate swap chain: -13
Unfortunately issue persists, every single version in the archive returned Error -13 as usual. Tried latest master, https://github.com/doitsujin/dxvk/commit/5312ef1cf9c201d20048f9e796d21b436420fd49 as well.
I meant for the glitches, not for the error which is really out of the blue.
Update for this issue.
Cannot create the visual glitches in cubemaps on RADV. However the game itself is crashing on startup with the error mentioned above on anything above 23.8.2 drivers on Windows. Here's an apitrace with DXVK thanks to Blisto91.
Update on this issue again. Using the 24.20.11.01 drivers and DXVK 2.4.1; DXVK is once again able to log err: D3D9SwapChainEx: Failed to recreate swap chain: -13 and then crash.
Found the issue! DXVK fails to create swapchain ONLY if the game goes fullscreen, Since TDU2 always defaults to fullscreen when it detects hardware change; this bug is unfixable by the user. Here's an other game (Need for Speed 2015) that used to crash in same fashion running under DXVK, going fullscreen also crashes this game. Will experiment further to somehow force TDU2 to start in borderless/windowed.
With the help of DXWrapper's "Enable Windows Mode" and "Dialog Mode" from DXVK config, game runs alter doing ALT+ENTER once.
EDIT: Here's the log files where you can see how the game struggles to create swapchain.
TestDrive2_d3d9.log
d3d9-testdrive2.log
EDIT 2: After setting the game to windowed mode with dxwrapper, dxwrapper itself can be removed. Unfortunately game crashes after few minutes of gameplay regardless. here is the logs on game crash with DXVK alone.
TestDrive2_d3d9.log
The swapchain code is in the process of being rewritten anyway. So there's no point in looking into this before that's done.
These are on the vulkan-swapchain-raw branch already, it's actually what prompted me to test. Thank you!
Oh, okay. Yeah that's exactly what I meant.
Forgot to update this issue. It's fixed for quite a while now. Game is extremely wonky with fullscreen now, but that's a entirely different issue.
d3d9.dllx1 2024-02
Software information
Tested TDU2 both vanilla and modded. DXVK 2.0 and up exhibit issues with car reflections within the delivery missions (bomb icon on the map). Open world, interiors and races are fine however. 1.10.3 and lower (tried 1.5.4) appear to work fine.
DXVK 2.3

DXVK 1.10.3

System information
Apitrace file(s)
Log files