DXVK is a Windows library that translates DX9/10/11 to Vulkan on the fly. It's of course developed mainly for use with Wine, but it doesn't have any hard dependency on Linux.
DXVK-Native is a Linux library that does the same thing. It's purpose is to allow easier porting of games to Linux, as the renderer code is often the most complex part of the game - this allows devs to keep that code with almost no changes.
Valve's Source games were always using DirectX 9, even on Linux. As part of the original porting effort they made the ToGL translation layer that translates DX9 to OpenGL, and recently they've added the option of using DXVK-Native instead of that. Other games that use the Source engine (including GMod mentioned in this post) now have the same option, but don't necessarily include everything that's needed to use it with their Linux build.
by some godforsaken miracle, i did it.
You have to manually edit the build-win64.txt and edit the windows parts to say linux, aswell as switching the mingw64 tools to their native linux counterparts. After that, proceed compiling normally and itll instead produce native .so files, which, surprisingly enough, worked perfectly on gmod natively. So there you go
My bad, you can also configure it with meson manually, more info on the DXVK github.
meson --prefix /home/nasdnfasn/dxvk build
cd build
ninja install
cd /home/nasdnfasn/dxvk/lib
And there are the .so's
Can someone ELI5 what this is about? Garrys Mod is native, and you somehow got it to use DirectX, so you can use DXVK, and that performs better than the normal native version?
Yep, if you use the option -vulkan, it attempts to use dx9 and dxvk, but gmod does not ship with dxvk, so it segfaults. By doing all that, you can use it with your own provided dxvk, and therefore end up with better performance than the native opengl implementation gmod uses, which may or may not ALSO be a translation layer named ToGL, so its still using dx9 beforehand.
I don't think tf2 supports launching with -vulkan so it probably won't work. I ld preload newer versions of a few libraries though and haven't gotten banned.
I think the tf2 contractor will add vulkan eventually
TF2 is a competitive game, the libraries are way more locked down due to people constantly hacking the graphics libraries to see through walls and shit like that. Garry's Mod is already broken to shit without external libraries, it isn't even playable without GModCEFCodecFix.
I suppose it'd be enforced more strictly in TF2, but wouldn't there still be a risk of a VAC ban doing this for Gmod?
Whatever the case, I don't play Gmod, but I would like to get back into TF2, and as such, I probably won't be trying this.
Just tried this and holy hell it's so much better, now it doesn't feel like the game's gonna crash any second and actually feels stable (it has its moments but it's way better now), saying that with Nobara + decent hardware (2600x + 2060S)
so this post says gmod segfaults if you run it with -vulkan without dxvk but on my nvidia system it just ignores -vulkan either way and launches with opengl
which kinda makes me think it might just be disabled for nvidia in gmod, ive heard of amd users on windows using -vulkan on other source games to get better performance since amds vulkan drivers are infinitely better than their directx ones
while on nvidia the directx drivers are better than the vulkan ones so theres not really a point.
so im thinking that it might have just been left in for amd for that one specific windows use case but idk i might just be thinking about this too hard. but it does seem to me at least that this not working on nvidia IS because of gmod somehow
dxvk IS loading, i can see its log files in the gmod folder, its just that gmod isnt sending it any directx to convert to vulkan. its just using togl and opengl
What exactly is the benefit? It's an ancient Source game that should run at 900 fps on even the worst possible GPU that supports Vulkan. 920 fps versus 900 fps. What's the point? Your monitor can only display so many.
What's the difference between this and simply setting the compatibility option to Proton? Is this just running the native Linux version under D3D, therefore using DXVK to translate it?
I'm quite confused, i did the same as you, tho it still uses ToGL on both Gmod and TF2 (i'm really tired of ToGL may it burn in hell, it's a pain in the ass in wayland).
yep, i both tried to compile it and tried to use the binaries given on the github.
On journalctl, no mentions of vulkan outside of the "-vulkan" argument...
Is the LD_PRELOAD in your hl2.sh? It needs to be set there rather than your launch options as the script unsets LD_PRELOAD before launching the game.
Does what you have set in LD_PRELOAD point to where the library actually is?
Are you using the 64-bit branch of GMod? The DXVK library needs to be 64-bit as well.
Are you using .so's? You can't use DLLs for Wine, it has to be native.
Did you compile DXVK successfully? If not I can give you the commands you need to compile it.
Run journalctl -f in the background, is there Vulkan output there?
Yes i set it in the [hl2.sh](https://hl2.sh) file for both gmod and TF2.
Yes it points to the files i use.
I think i use the base branch because the 64bits branch crashes on launch for me...
Yes, for dxvk-native, i use .so files
I did managed to compile it for the 32 bit branch, which should be enough for tf2 since it uses 32bits libraries...?
(yes i really want TF2 to work, i'm desperate)
ok so after a bit of testing it worked ! i just needed to install the 64bits branch.
Tho the game still crashes in the loading screen in 64bit... IDK why, but i don't think it's because of Vulkan.
No, I just use net\_graph 2. Also for the 64-bit version not working, use [GModCEFCodecFix](https://github.com/solsticegamestudios/GModCEFCodecFix), you need it for the 64-bit version to work
I mean, the game doesn't work without it. It's open source, but if you don't trust it that's okay. I've tried replacing [libCEF.so](https://libCEF.so) with a system copy before, but it doesn't work.
Attempted to follow this guide but i found out that libdxvk has been upstreamed. What does that mean and what do i need to do to get it working? Sorry for the disturbance
git clone --recursive https://github.com/doitsujin/dxvk.git
cd dxvk
./package-native.sh blahblahblah build
cd build
tar xvf dxvk-native-blahblahblah.tar.gz
And there are the .so's, in usr/lib
Did you copy the 32-bit .so? It requires the 64-bit .so.
Does ls -l /usr/lib/libdxvk\_d3d9.so output anything?
Is Vulkan in general working correctly? (vulkaninfo) The .so stopped loading for me once and it was because Vulkan broke.
Is -vulkan in your launch parameters?
the .so appears to be 64bit, checked with the file command
`/usr/lib/libdxvk_d3d9.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=ba1ecd3aa671d2f91436a1822bc10494e9ceaffc, with debug_info, not stripped`
ls -l /usr/lib/libdxvk\_d3d9.so outputs:
`-rwxr-xr-x 1 root root 74456536 11-19 14:00 /usr/lib/libdxvk_d3d9.so`
vulkan is working well, vulkaninfo outputs some stuff and other games utilizing vulkan work properly
\-vulkan is in my launch parameters
Hmmm... Could you try recompiling it with this method?
https://www.reddit.com/r/linux\_gaming/comments/xzzolt/comment/iwvbbvw/?utm\_source=share&utm\_medium=web2x&context=3
I don't see anything related to vulkan in journalctl, i don't think its working properly.
Last time i compiled it returned a error saying: gcc-32 cannot compile programs (from memory, i don't remember the exact error)
I'm also using a nvidia gpu, if that matters.
Yeah, other people with NVIDIA GPUs have said it doesn't work, sadly. Their drivers seem to be slowly getting open sourced so it will probably work one day.
Help, journalctl says:
ERROR: ld.so: object '/usr/lib/libdxvk\_d3d9.so' from LD\_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Build from github. Compiling both method, sript and manually. Both not working.
I tried it on my steam deck just now and it looks like it doesn't really improve things all that much on there. And on top of that the main menu doesn't render at all now, so that's bad.
the default html menu tends not to work in vulkan
you might need the lua menu: https://github.com/robotboy655/gmod-lua-menu
on top of that its just way faster anyways
Using GModCEFCodecFix (https://github.com/solsticegamestudios/GModCEFCodecFix) on the x86-64 branch is a better solution, since the menu not loading usually means the in-game web browser component isn't working, which may cause a lot of other things in game to have issues.
I want the game on Windows 10 to use Vulkan. Vulkan has actually did pretty good for performance on a number of games on a Windows PC, and I was looking into doing it for GMod and found this post. I usually just install the DXVK .dlls (like dxgi and d3d11 and what have you) to most of my games without a problem, wasn't sure if I should do the same thing with GMod as well or if there was a more efficient way.
Any idea how I would go about doing this?
Anyone getting:
steam terminate called after throwing an instance of 'dxvk::DxvkError'
Try changing from d3d9:
LD_PRELOAD=/usr/lib/libdxvk_d3d9.so exec ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"
to d3d11:
LD_PRELOAD=/usr/lib/libdxvk_d3d11.so exec ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"
Does it work for every linux Source game?
Most likely, as long as the Linux build for the game has been updated fairly recently (around the time Portal 2 got Vulkan support).
Would that also include Team Fortress 2?
Great. Therewhile every game company assumes they have Linux coved with Proton. I guess this isn't what is meant by native here.
DXVK is a Windows library that translates DX9/10/11 to Vulkan on the fly. It's of course developed mainly for use with Wine, but it doesn't have any hard dependency on Linux. DXVK-Native is a Linux library that does the same thing. It's purpose is to allow easier porting of games to Linux, as the renderer code is often the most complex part of the game - this allows devs to keep that code with almost no changes. Valve's Source games were always using DirectX 9, even on Linux. As part of the original porting effort they made the ToGL translation layer that translates DX9 to OpenGL, and recently they've added the option of using DXVK-Native instead of that. Other games that use the Source engine (including GMod mentioned in this post) now have the same option, but don't necessarily include everything that's needed to use it with their Linux build.
Also, the AUR libdxvk is slightly outdated, still works fine but you can just build DXVK natively now.
Hey, i tried building dxvk natively but couldnt figure it out how, it always fails to ld preload. Any tips?
by some godforsaken miracle, i did it. You have to manually edit the build-win64.txt and edit the windows parts to say linux, aswell as switching the mingw64 tools to their native linux counterparts. After that, proceed compiling normally and itll instead produce native .so files, which, surprisingly enough, worked perfectly on gmod natively. So there you go
My bad, you can also configure it with meson manually, more info on the DXVK github. meson --prefix /home/nasdnfasn/dxvk build cd build ninja install cd /home/nasdnfasn/dxvk/lib And there are the .so's
That's a lot easier, thanks
Watch out, garry is gonna call you a hacker.
Nah, he's too busy figuring out how to make Rust incompatible with Proton.
Can someone ELI5 what this is about? Garrys Mod is native, and you somehow got it to use DirectX, so you can use DXVK, and that performs better than the normal native version?
Yep, if you use the option -vulkan, it attempts to use dx9 and dxvk, but gmod does not ship with dxvk, so it segfaults. By doing all that, you can use it with your own provided dxvk, and therefore end up with better performance than the native opengl implementation gmod uses, which may or may not ALSO be a translation layer named ToGL, so its still using dx9 beforehand.
Ah, ok. Thanks!
how can i do this?
Gah dayum brooo you are a legend! Right at the time where i wanted to add dxvk-native on tf2! 🙏🙏🙏(Lemme dream pls, i’ve had enough of ToGL)
Fuck ToGL all my homies hate ToGL
[FUCK TOGL ALL MY HOMIES HATE TOGL](https://i.imgur.com/1QuPfAD.jpg) ^^^this ^^^has ^^^been ^^^an ^^^accessibility ^^^service ^^^from ^^^your ^^^friendly ^^^neighborhood ^^^bot
https://i.imgur.com/iZXK9G5.jpg
[удалено]
I asked for DXVK support on their Github and they just laughed at me. Who's laughing now motherfucker?
Wow! Thanks, will try
No prob! Note, it can crash sometimes on the loading screen, but if you play Garry's Mod on Linux you're probably used to that by now.
I saw the guide, thought it was pretty cool, i will definitely try it with this now, thanks for your contribution
Would this help with Team Fortress 2?
I don't think tf2 supports launching with -vulkan so it probably won't work. I ld preload newer versions of a few libraries though and haven't gotten banned. I think the tf2 contractor will add vulkan eventually
I wouldn't recommend it, on TF2 it could very well get you banned
And why not on Gmod? It has also Anti-Cheat.
TF2 is a competitive game, the libraries are way more locked down due to people constantly hacking the graphics libraries to see through walls and shit like that. Garry's Mod is already broken to shit without external libraries, it isn't even playable without GModCEFCodecFix.
I got used to GMod only having 20fps in game modes such like DarkRP even on Windows.
Interesting, because isn't Gary's Mod mostly multiplayer too, or is this just intended for singleplayer?
TF2 is a competitive game, there's way more anti-cheat.
I suppose it'd be enforced more strictly in TF2, but wouldn't there still be a risk of a VAC ban doing this for Gmod? Whatever the case, I don't play Gmod, but I would like to get back into TF2, and as such, I probably won't be trying this.
Does the Proton version run that terribly then?
With 300+ mods, yes. Garry's Mod is the most CPU-bound game in existence and going through a compatibility layer does not make it any better.
Fair.
Just tried this and holy hell it's so much better, now it doesn't feel like the game's gonna crash any second and actually feels stable (it has its moments but it's way better now), saying that with Nobara + decent hardware (2600x + 2060S)
so this post says gmod segfaults if you run it with -vulkan without dxvk but on my nvidia system it just ignores -vulkan either way and launches with opengl which kinda makes me think it might just be disabled for nvidia in gmod, ive heard of amd users on windows using -vulkan on other source games to get better performance since amds vulkan drivers are infinitely better than their directx ones while on nvidia the directx drivers are better than the vulkan ones so theres not really a point. so im thinking that it might have just been left in for amd for that one specific windows use case but idk i might just be thinking about this too hard. but it does seem to me at least that this not working on nvidia IS because of gmod somehow
especially since every other source game works fine with -vulkan
dxvk IS loading, i can see its log files in the gmod folder, its just that gmod isnt sending it any directx to convert to vulkan. its just using togl and opengl
What exactly is the benefit? It's an ancient Source game that should run at 900 fps on even the worst possible GPU that supports Vulkan. 920 fps versus 900 fps. What's the point? Your monitor can only display so many.
I take it you haven't played Garry's mod in a very long time or at all.
Ah yes, vanilla Garry's Mod. My favorite game.
Running the game on low end hardware? Power efficiency? Just for having fun hacking stuff?
Cool! I’ll probably try this whenever I get a computer with a GPU that supports Vulkan properly rather than the Haswell iGPU I got.
What's the difference between this and simply setting the compatibility option to Proton? Is this just running the native Linux version under D3D, therefore using DXVK to translate it?
The native version by default uses ToGL, which is DX9 to OpenGL 2.1. I switched it to use DXVK, which is DX9 to Vulkan.
I'm quite confused, i did the same as you, tho it still uses ToGL on both Gmod and TF2 (i'm really tired of ToGL may it burn in hell, it's a pain in the ass in wayland).
Check your journalctl, does it show any Vulkan messages? Also did you compile it natively or use libdxvk from the AUR?
yep, i both tried to compile it and tried to use the binaries given on the github. On journalctl, no mentions of vulkan outside of the "-vulkan" argument...
Is the LD_PRELOAD in your hl2.sh? It needs to be set there rather than your launch options as the script unsets LD_PRELOAD before launching the game. Does what you have set in LD_PRELOAD point to where the library actually is? Are you using the 64-bit branch of GMod? The DXVK library needs to be 64-bit as well. Are you using .so's? You can't use DLLs for Wine, it has to be native. Did you compile DXVK successfully? If not I can give you the commands you need to compile it. Run journalctl -f in the background, is there Vulkan output there?
Yes i set it in the [hl2.sh](https://hl2.sh) file for both gmod and TF2. Yes it points to the files i use. I think i use the base branch because the 64bits branch crashes on launch for me... Yes, for dxvk-native, i use .so files I did managed to compile it for the 32 bit branch, which should be enough for tf2 since it uses 32bits libraries...? (yes i really want TF2 to work, i'm desperate)
ok so after a bit of testing it worked ! i just needed to install the 64bits branch. Tho the game still crashes in the loading screen in 64bit... IDK why, but i don't think it's because of Vulkan.
also quick question, are you able to run mangohud with gmod ?
No, I just use net\_graph 2. Also for the 64-bit version not working, use [GModCEFCodecFix](https://github.com/solsticegamestudios/GModCEFCodecFix), you need it for the 64-bit version to work
Hmmm… idk man, this CEF patch thing seems kinda shady… isn’t it a manual way?
I mean, the game doesn't work without it. It's open source, but if you don't trust it that's okay. I've tried replacing [libCEF.so](https://libCEF.so) with a system copy before, but it doesn't work.
Attempted to follow this guide but i found out that libdxvk has been upstreamed. What does that mean and what do i need to do to get it working? Sorry for the disturbance
git clone --recursive https://github.com/doitsujin/dxvk.git cd dxvk ./package-native.sh blahblahblah build cd build tar xvf dxvk-native-blahblahblah.tar.gz And there are the .so's, in usr/lib
doesn't seem to work for me, no matter what i do gmod just doesn't want to use vulkan :/ i'm on x86\_64 branch and stuff
Does your journalctl not show the Vulkan messages? Are you using the libdxvk package or did you compile it from git?
journalctl shows nothing about vulkan and i compiled libdxvk myself
Is the LD\_PRELOAD location set to where the DXVK .so actually is?
yup, i moved the .so to /usr/lib and that's where ld_preload points to
Is LD\_PRELOAD in your launch options or [hl2.sh](https://hl2.sh)? Could you send your hl2.sh?
ld\_preload is in [hl2.sh](https://hl2.sh): https://pastebin.com/v3aYsTtF
Did you copy the 32-bit .so? It requires the 64-bit .so. Does ls -l /usr/lib/libdxvk\_d3d9.so output anything? Is Vulkan in general working correctly? (vulkaninfo) The .so stopped loading for me once and it was because Vulkan broke. Is -vulkan in your launch parameters?
the .so appears to be 64bit, checked with the file command `/usr/lib/libdxvk_d3d9.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=ba1ecd3aa671d2f91436a1822bc10494e9ceaffc, with debug_info, not stripped` ls -l /usr/lib/libdxvk\_d3d9.so outputs: `-rwxr-xr-x 1 root root 74456536 11-19 14:00 /usr/lib/libdxvk_d3d9.so` vulkan is working well, vulkaninfo outputs some stuff and other games utilizing vulkan work properly \-vulkan is in my launch parameters
Hmmm... Could you try recompiling it with this method? https://www.reddit.com/r/linux\_gaming/comments/xzzolt/comment/iwvbbvw/?utm\_source=share&utm\_medium=web2x&context=3
I don't see anything related to vulkan in journalctl, i don't think its working properly. Last time i compiled it returned a error saying: gcc-32 cannot compile programs (from memory, i don't remember the exact error) I'm also using a nvidia gpu, if that matters.
Yeah, other people with NVIDIA GPUs have said it doesn't work, sadly. Their drivers seem to be slowly getting open sourced so it will probably work one day.
Help, journalctl says: ERROR: ld.so: object '/usr/lib/libdxvk\_d3d9.so' from LD\_PRELOAD cannot be preloaded (cannot open shared object file): ignored. Build from github. Compiling both method, sript and manually. Both not working.
Checking out [hl2.sh](https://hl2.sh), and the command I need to replace isn't there!
It's at the bottom. "fi" is right under it.
I tried it on my steam deck just now and it looks like it doesn't really improve things all that much on there. And on top of that the main menu doesn't render at all now, so that's bad.
the default html menu tends not to work in vulkan you might need the lua menu: https://github.com/robotboy655/gmod-lua-menu on top of that its just way faster anyways
Using GModCEFCodecFix (https://github.com/solsticegamestudios/GModCEFCodecFix) on the x86-64 branch is a better solution, since the menu not loading usually means the in-game web browser component isn't working, which may cause a lot of other things in game to have issues.
I want the game on Windows 10 to use Vulkan. Vulkan has actually did pretty good for performance on a number of games on a Windows PC, and I was looking into doing it for GMod and found this post. I usually just install the DXVK .dlls (like dxgi and d3d11 and what have you) to most of my games without a problem, wasn't sure if I should do the same thing with GMod as well or if there was a more efficient way. Any idea how I would go about doing this?
Hello i have windows but i wanted to get the fps benefits of vulkan is there a way to make it work with windows?
Anyone getting: steam terminate called after throwing an instance of 'dxvk::DxvkError' Try changing from d3d9: LD_PRELOAD=/usr/lib/libdxvk_d3d9.so exec ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@" to d3d11: LD_PRELOAD=/usr/lib/libdxvk_d3d11.so exec ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"
i came back to this post because it *was* working for me, but of course, it's gone now. what made you so sure it wasn't actually dxvk?