doitsujin / dxvk

Vulkan-based implementation of D3D8, 9, 10 and 11 for Linux / Wine
zlib License
12.73k stars 817 forks source link

[d3d9] OMSI stops loading tiles during night or rain #2354

Open RedJokerSoftware opened 2 years ago

RedJokerSoftware commented 2 years ago

OMSI stops loading tiles at night or rain(when nightmap is being used) this issue happens when the game is out of memory, something on dxvk is not disposing correctly the allocated memory. maybe this happens due to this message, found on dxvk log:

warn: ConvertFormat: Unknown format encountered: D3D9Format::AL16 warn: ConvertFormat: Unknown format encountered: D3D9Format::R16

i've noticed that DDS textures take some time to get processed and some meshes appear as untextured i have made some tests with DDS's and all the formats of d3d9 have this issue.

DXVK 1.9.2 d3d9 Windows 10 Vulkan 2.0.168 20.45.40.04-210405a-366334C-RadeonProEnterprise video driver

Omsi236rc6_d3d9.log

K0bin commented 2 years ago

I assume OMSI is Omnibus simulator?

Can you make an apitrace? The logs don't have anything useful.

RedJokerSoftware commented 2 years ago

Yes, Omnibus simulator 2. i can't upload, it is too big 11GB.

K0bin commented 2 years ago

We can't do anything without an apitrace. Try compressing it.

RedJokerSoftware commented 2 years ago

I've made a new apitrace with 2.85GB. link: https://www.mediafire.com/file/yio84bhzdn7y232/Omsi2-trace.zip/file

K0bin commented 2 years ago

I can't tell whats wrong with it. Can you post some screenshot of what it looks like with DXVK and what it should look like?

image

RedJokerSoftware commented 2 years ago

The game works properly but some time later the errors appear:

The first part of the error is the lightmap error:

image

When this happens OMSI 2 stops the tile loading process and if you continue to drive you will reach to the border of the tile:

image this makes OMSI unplayable on night or rain situations, but the framerate increase very great, sometimes from 10 to 30 fps.

the lightmap bug rarely appear on directx, but some seconds later disappear. The tile loading issue happens when the game is out of memory, as a 32 bit software this may happen, but dxvk causes this error much earlier.

K0bin commented 2 years ago

The lightmap thing is just the game being slow on streaming in additional data. I could see that in the apitrace but I don't see how that's caused by DXVK.

Completely stopping streaming didnt happen in your apitrace.

RedJokerSoftware commented 2 years ago

should i try to make a new apitrace with the game and dxvk together?

K0bin commented 2 years ago

We could try that. I don't know if thats gonna be useful either though.

RedJokerSoftware commented 2 years ago

I've found way to mitigate these problems: First install 4GB patch, open the game, go to options, graphics(Advanced) and increase the value on Max. Tex. Mem. for high-res tex load to about 3096.0 I was able to drive for about 8 KM on night. the issue still happens, but it takes much more time to appear.

RedJokerSoftware commented 2 years ago

I've made some extra tests on version 1.9.4, the bug was a bit mitigated (loading about 1 extra tile on same settings of the last comment), during my tests DXVK log file had the below lines only when terrain lightmap was activated. warn: ConvertFormat: Unknown format encountered: D3D9Format::AL16 warn: ConvertFormat: Unknown format encountered: D3D9Format::R16

The terrain lightmap is a simple .BMP texture with 256x256 and 24 bit depth, probably the problem is a conversion made while loading these images.

RedJokerSoftware commented 2 years ago

here is one terrain lightmap texture: tile_2382_11287.map.LM.zip

K0bin commented 2 years ago

warn: ConvertFormat: Unknown format encountered: D3D9Format::AL16 warn: ConvertFormat: Unknown format encountered: D3D9Format::R16

Those aren't a problem. Windows driver dont support those formats either.

RedJokerSoftware commented 2 years ago

Update: with 1.10.0 i was able to drive without any tile loading issues, but when raining the bug still persists. anyway excellent work, now OMSI is very playable.

Blisto91 commented 2 years ago

If you think there is a memory issue try to test K0bin's new PR https://github.com/doitsujin/dxvk/pull/2663 Link to latest version as of this moment: https://github.com/doitsujin/dxvk/actions/runs/2480480782

szopisiu commented 2 years ago

There is also a large group of people in the comments under the tutorial on steamcommunity, which teaches how to install the dxvk itself in omsi. In short, for me and these people the problem is the same as @RedJokerSoftware described it.

So I tested K0bin's PR and it doesn't fix the problem, I also tested the latest version 1.10.1 of dxvk and this version: #1341 but unlike RedJokerSoftware this problem always occurs for me.

Blisto91 commented 2 years ago

I'm seeing other tools/mods such as ENB mentioned in that guide. Are you having the issue in the base game with just dxvk? What are your game settings.

szopisiu commented 2 years ago

I use clean dxvk without SweetFX or ENB. Yes, I only have problems with the game with dxvk installed. I tried the latest version 2.3.004 of the game, but with no positive effects. I always play on version 2.2.032 I also got a message that the problem is fixed in dxvk from v1.9 and above. Steam guide has outdated version. I've tried many of these versions above v1.9 but this error always occurs.

Here are my graphics settings:

Zrzut ekranu 2022-07-02 115753 Zrzut ekranu 2022-07-02 115805

Blisto91 commented 2 years ago

So i've been playing for a little while on linux and i think i am reproducing. I haven't seen a hole or white piece of road besides when they load in, but sometimes the buildings or vehicles stay white. I also usually crash shortly after.

Sadly i have not found any config options that seem to make it disappear. I'm not a dev so i can't do too much debugging myself.

szopisiu commented 2 years ago

Tested 1.10.3 version, the problem persists.

Blisto91 commented 2 years ago

Try current master instead. https://github.com/doitsujin/dxvk/actions/runs/2852177417

Note that you need relatively up to date drivers to use it

szopisiu commented 2 years ago

I am using the latest drivers. Also tried this version.

There are a few people who also tried to use newer versions than 1.9.4 but with no luck. Apparently the dxvk for this game is unstable and it works differently for everyone

Blisto91 commented 2 years ago

Just to refresh my memory has it always been like this or did it used to work with older dxvk versions?

szopisiu commented 2 years ago

The problem with not loading tiles during the night and rain occurred before version 1.9.4 For the versions above, the problem has disappeared for most people

Blisto91 commented 2 years ago

K. I will try to test a bit again and see if i can find some hints.

Blisto91 commented 2 years ago

@szopisiu I'm trying to find out if it worked in the olden times and is a regression. Can you check if the issue shows for you with d9vk 0.40? https://github.com/Joshua-Ashton/d9vk/releases/tag/0.40

szopisiu commented 2 years ago

Ok, I tested it and it also has the same error. The performance was definitely worse than with the Doitsujin's dxvk. It was not more than 60 FPS.

I don't know if it matters but after installing it I got error 0xc0000005 after trying to start the game. Enabling DEP in Permormence Option for the game allowed it to run.

Blisto91 commented 2 years ago

Ye a lot has been optimized since then. Don't think the error matters, i don't expect these old versions to work well in general.

It's a annoying bug to reproduce since i have trouble doing it consistently and it takes a bit of time to happen. Also when i try to play with apitrace the game grinds to a halt. But since you seem to have more "luck" can also check 0.13f? https://github.com/Joshua-Ashton/d9vk/releases/tag/0.13f If it also reproduces there i'm gonna conclude it has always been a issue. If you can even start the game with it that is.

Are you able to recommend a scenario or map where it seems easier to reproduce? I'm guessing since the title is OMSI stops loading tiles during night or rain it happens in some situations more than others?

szopisiu commented 2 years ago

First, I would like to apologise for the late reply. So, I reinstalled the system from Windows 10 to Windows 11. I thought a clean system and a game could solve the problem. I installed d9vk 0.13f from joshua. I was able to start the game and load the map. There was no problem with loading the tiles. Only with the exception that the game had some shading bug. You can see what it looked like on the screenshots.

Zrzut ekranu (2) Zrzut ekranu (1)

I thought windows update would install the latest drivers but the graphics driver version was something like 47x.xx during this test. After installing the latest driver, I was unable to start the game with d9vk 0.13f due to the same 0xc0000005 error. I am not able to fix it in any way.

In fact, the best map to create this error is any map that has a lot of street lighting. For example, the default available in the game Berlin-Spandau. In the event of rain just turn on rain in weather settings. The quickest way to cause this error is to simply use the camera under the F4 key to fly over the map. It takes about 1-2 minutes to find an unloaded tile. Sometimes it even happens that an adjacent tile cannot load. During rain, light maps are also loaded. Therefore, the error occurs in these two cases. Earlier I forgot to specify that, as far as I know, the error in rain still occurs. Remember that this error may not occur for you with the latest dxvk version.

Another thing I would like to show are errors in game logfile that appear while tile fails to load. These errors suggest that human models were causing this error ??? I dunno

503 15:26:38 -  -   Error:           Zugriffsverletzung bei Adresse 007F2E07 in Modul 'Omsi.exe'. Lesen von Adresse 00003FF4: CHAD - Humans - Get Ambient Light
5536 15:27:00 -  -   Error:           Zugriffsverletzung bei Adresse 007F2E07 in Modul 'Omsi.exe'. Lesen von Adresse 3F800000: CHAD - Humans - Calculate
5537 15:27:00 -  -     Warning:       Could not lock light map of tile 14 for getting ambient light for moving object! Error: D3DERR_INVALIDCALL

Maybe @sjain882 could say something about it. As far as I know, dxvk works for him during the night in game. He worked on reverse engineering this game etc.


my computer specs in case anyone needs to know: Windows 11 Education 21H2 AMD Ryzen 5 2600 24 GB RAM 2993 MHz NVIDIA GTX 1650 Super Driver version 516.94.0 Vulkan 1.3.205

and sending the file with my new game settings options.cfg.txt

Blisto91 commented 2 years ago

Thanks for all the info. I didn't even know there was a free fly camera. Will be useful. I don't even know yet how to start the bus so i always let the ai do it and then take over afterwards. 😄

RedJokerSoftware commented 1 year ago

Update: I've upgraded my GPU to an RX 6800, with the latest drivers, Windows update and DXVK version the tile loading bug reappeared for me, but takes more time to show up.

vike001141 commented 1 year ago

Has anyone found a fix for this, experiencing the same problem

Blisto91 commented 1 year ago

Not yet. Since it's some interaction between dxvk and the game itself and not directly a rendering glitch that can be inspected in a apitrace it's probably very hard to debug.

rtang-7689 commented 1 year ago

I encounter similar problem as well image I made this map and it just happened when I tried to add streetlights Normally this happens when the large map played for a while I cant generate lm for that tile I tried to remove all other tiles and just one single tile, same results Finally I was able to create lm after putting that tile into a small test map I put those thing back to original map and it stays in that cringe tone at night Hopefully it will be a hint for you guys

K0bin commented 1 year ago

That's not useful. If you want us to look into it, we need an apitrace of the problem.

RedJokerSoftware commented 1 year ago

After some testing i've found the moment of the issue: the "refresh terrain" may hang during tile loading causing the problem. a way to fix: set "Load Whole Map at Start" on OMSI config. This will fix this issue (DXVK 2.3) as the full refresh will be made on the start, but there are some drawbacks: Loading will be very long, and your performance would be slightly reduced. For the best results you need the 4GB path, a very strong CPU (tested with a Ryzen 7 7700) and a fast SSD. Some big maps may not load due to memory limits of a 32bit software.