doitsujin / dxvk

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

Huge performance reduction on Black Mesa with bushes (possibly related to transparency?) compared to D3D9 #2575

Open Deus-nsf opened 2 years ago

Deus-nsf commented 2 years ago

This is very specific, but maybe this can help in other situations. or in general. In black mesa if you stand close to bushes (Surface Tension beginning of chapter for example), with DXVK the performance takes a nosedive, that doesn't happen with D3D9. The game uses alpha to coverage by default, but disabling it doesn't change anything, no matter the API.

Game is running at max settings, no anti-aliasing for that specific test. my dxvk.conf is clean, no special options enabled, and I'm using a GTX 1080 Ti with almost the latest driver (theres just one more recent than mine). DXVK 1.10.1. Didn't try other versions I admit.

If that can help finding some specific transparency related issues maybe, I'd be glad.

K0bin commented 2 years ago

Please make an apitrace of the scene so we can look into this.

Deus-nsf commented 2 years ago

{"message":"Artifact not found or access denied."} ( from https://ci.appveyor.com/api/projects/jrfonseca/apitrace/artifacts/build/apitrace-latest-win32.7z?branch=master&job=msvc32 )

K0bin commented 2 years ago

Where did you get that download link?

I recently updated the guide to point towards a link that isn't dead. https://github.com/doitsujin/dxvk/wiki/Making-a-Trace

Deus-nsf commented 2 years ago

sorry I got the wrong link by looking at the git diff, took the red line instead of the green line, I'm lacking sleep! the link you provided totally works though, I'm on it

K0bin commented 2 years ago

Okay, I was just wondering whether we still had the broken links somewhere.

Deus-nsf commented 2 years ago

here you go: https://mega.nz/file/HlhywISI#0NATAWWauGloV4YxXojHke0DdO_yrixB6nIQRI7bGrc

I did the entering and leaving the bush 3 times, the 3rd (and last) time I stayed a bit longer inside the bush

Deus-nsf commented 2 years ago

Black Mesa also tends to crash a lot in the late chapters due to memory management issues, doesn't crash in D3D9, but as I have seen an update/merge is apparently coming for that problem for all games so I won't create another issue for that.

K0bin commented 2 years ago

Black Mesa also tends to crash a lot in the late chapters due to memory management issues, doesn't crash in D3D9, but as I have seen an update/merge is apparently coming for that problem for all games so I won't create another issue for that.

I cannot reproduce that at all. I'm currently playing through it with Proton and I've made it to the Lambda Core level and it has not crashed once. It doesn't use a lot of memory either.

Deus-nsf commented 2 years ago

Oh earthbound levels are fine, it's mostly Xen. It usually happens on level transition. It won't happen if you don't play a lot in the same session or relaunch the game often. If you can blast through Xen + Gonarch in a single session without crashing though, well, the problem may be on me.

EDIT: by searching in the source engine console commands I found this:

cl_always_flush_models "If set, always flush models between map loads. Useful on systems under memory pressure."

switching it to 1 seem to get rid of the crashing scenarios I had, at no cost in loading times (at least I couldn't notice it) which is very good news, I need to test this further to be sure though

well, it helped with the crash on loading but late game still crashes.

K0bin commented 2 years ago

Are you GPU or CPU bound? Is GPU utilization at 100% when looking at the bushes or otherwise?

Deus-nsf commented 2 years ago

completely GPU bound, it is at 100% utilization

K0bin commented 2 years ago

There's a lot of overdraw with those bushes but I don't see why that would only be a problem for DXVK.

Deus-nsf commented 2 years ago

I don't know either but this time since the performance hit is the same between Linux and Windows I think something is special there. (also I found the culprit for the other issue, it was the steam shader pre-caching, I'm never going to re-enable this option!)

Blisto91 commented 1 year ago

@Deus-nsf Hi there. Could i get you to retest this issue? I can reproduce a GPU usage spike when playing a bit around with the two big bushes at the beginning of Surface Tension and dxvk 1.10.1. This seems to have been resolved in newer dxvk's versions tho and i'm not reproducing the same with 2.1

Edit: actually nvm, i think i maybe just reproduced again. A bit unsure what was going on Edit 2: although messing with the apitracemode config might be what caused it again.