technical questions about how proton and dxvk work
ExpandingMan Oct 27, 2021
Hello all, this is my first post on this forum.

This site has lots of useful information on proton and dxvk which has been very useful for me, so thanks for that! However, I have a bunch of slightly more technical question about how it all works that I haven't been able to find answers to:

## Compiling Caching of Vulkan Shaders (and any other binaries that might be needed)
My (very limited) understanding of vulkan suggests that some amount of pre-compilation and caching is required, and that this will be needed for every game running dxvk. Steam pushes lots of small updates on linux, but I'm not really sure what this is, are they related? How can you know what to compile before running the game? Is compilation of shaders the main source of stuttering on some dxvk games? (I noticed early on that this stuttering is usually gone by about an hour of play, so I suspect it is compilation.) What happens when a game is updated, does it need a completely new cache?

## Why is DX12 not usually better for dxvk?
My understanding of DX12 is that it should be roughly isomorphic to vulkan. I would therefore expect DX12 games to run *MUCH* better than DX11 games, but this is not what I find. In most cases I find games run much worse in DX12 mode than DX11 mode. Can anyone say anything about how dxvk operates for DX12 vs DX11?

## Where can I find a guide on how to use proton directly via the command line or scripts?
I think I have mostly figured this out: each games seems to have its own windows file system in `~/.local/share/Steam/steamapps/compatdata/$APPID/pfx` and this needs to be set as `STEAM_COMPAT_DATA_PATH` and then the `proton` python script can configure proton to run with the appropriate binaries. I don't see any documentation on any of this however, and I had to figure it all out by looking at the source code. I see lots of documentation for environment variables but no guide for how to actually run the thing. Is there somewhere else I should be looking?

I have a lot more questions but this should make for a good start. Thanks all!
denyasis Oct 27, 2021
Welcome to the forum!!

If I can pile on, I also have a question about the pre compilation of shaders.
Is that a proprietary Steam thing? Like, is possible to do the same thing with wine before running a game?

I also noticed the stuttering when using Lutris (wine), but not with proton and I assume it is the shader caching/compiling thing.
Shmerl Oct 28, 2021
Shaders are compiled by the Vulkan driver. Such as in case of AMD, radv would compile SPIR-V shader into amdgpu machine code. radv caches compiled shaders to avoid repeating that step.

However Windows games (unless they are made using Vulkan) aren't using SPIR-V but come with MS types of shaders. Dxvk and vkd3d-proton need to translate those shaders into SPIR-V first before actual compilation will happen. For example vkd3d-proton translates DXIL shaders into SPIR-V ones (and I think dxvk does that for the older ones - DXBC).

I'm not sure if caching happens for that step in some way, you'd need to look into it. I know that there is some caching for constructing of Vulkan pipelines in dxvk though, which is another repetitive task.

Last edited by Shmerl on 28 October 2021 at 7:00 am UTC
melkemind Nov 9, 2021
I came here looking to ask nearly the exact same questions, and poof, you've asked everything I was wondering. I've noticed that games using DXVK seem to have a lot of the early stutters (shaders compiling?) but VKD3D games don't. On the other hand, games using VKD3D have overall slower FPS. I've tested this on games that have both DX11 and DX12 support like Kena: Bridge of Spirits. It has much higher FPS in DX11 but stutters a lot. DX12 is pretty much smooth from the beginning, but the average FPS is lower. Note: I've experienced this with Nvidia drivers. I'm not sure if it's the same with AMD.
denyasis Nov 10, 2021
Ahh, so Steam is basically downloading and putting the finishing touches on compiled shaders made (some where else) for my specific hardware/software stack for that game? That's cool.

I noticed that when "Processing Vulkan Shaders", steam spawns a bunch of compilation processes, that must be it finishing up or filling gaps.

Thanks for the info and explaining it so well!
kit89 Nov 10, 2021
Quoting: ExpandingMan## Where can I find a guide on how to use proton directly via the command line or scripts?

I do believe there is a way to run proton from the command line independently from Steam, however I've not done so.

You can add non-steam games to your steam library:

From Main Steam Window: 'Games' >> 'Add a Non-Steam Game to My Library'.

A new window will appear, click the 'Browse' button at the bottom.

Another new window will appear, change the 'File type' to: 'All Files'. Now go to the location where the windows executable is and select it. Then click 'OPEN'.

The executable will be added to the 'PROGRAM' list, click the 'ADD SELECTED PROGRAMS'.

Go to your Library and search for the game you added, right click on its <executable name> >> 'Properties'.

Ensure the 'TARGET' has the name of the executable.
Ensure 'START IN' has the absolute file path to the executable.

e.g.

TARGET: mgsi.exe
START IN: "/home/username/GOG Games/METAL GEAR SOLID"
whizse Nov 10, 2021
Quoting: ExpandingMan## Where can I find a guide on how to use proton directly via the command line or scripts?
You can run the patched version of Wine in Proton the same way you run a normal Wine, with:
WINEPREFIX=/path/to/steamapps/compatdata/44350/pfx /path/to/steamapps/common/Proton\ -\ Experimental/files/bin/wine Game.exe

(Make something up for the WINEPREFIX if you're running something non-steam like a game from GOG)

This does require that library requirements for Wine are fulfilled on your distro and you need to manually enabled DXVK, Esync etc for the prefix.

Or you can run the whole Proton shebang which (I think?) should use the runtime shipped with Steam with something like:

STEAM_COMPAT_CLIENT_INSTALL_PATH="$HOME/.steam/steam" STEAM_COMPAT_DATA_PATH="/path/to/steamapps/compatdata/44350" /path/to/steamapps/common/Proton\ -\ Experimental/proton run Game.exe

Instead of Game.exe you can also call stuff like winecfg to change settings in a prefix (or control, regedit, regsvr32 etc.)

You need to figure out the Steam id for the game (a script can help you there) to use the right prefix and the necessary file paths, so consider this power user stuff.
ExpandingMan Nov 10, 2021
Thanks for helpful answers all. Sounds like, as far as stuttering and DX12 go, my expectations were basically correct.

I will try running proton later with whizse's suggestion, thanks.

They really could use some more documentation on the proton repo. Developers who are playing games (like me) are much more likely to give helpful reports or eventually do helpful things if they have some idea what's going on.
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register


Or login with...
Sign in with Steam Sign in with Google
Social logins require cookies to stay logged in.