↓ Skip to main content

After you press Play: how Windows games run on Linux

·3035 words·16 mins
Yenjia Chen
Author
Yenjia Chen
Deep learning, medical AI, data science, and mathematics.

Open Steam on Linux, pick a game that only ever shipped for Windows, and press Play. A few seconds later the title screen appears and your controller just works. Nothing to see here.

Have you ever stopped to think how remarkable that is? The game was never recompiled for Linux, and the computer never secretly booted Windows. So how is it running?

On Linux, the solution hides in a handful of names that always seem to show up together: Wine, Vulkan, DXVK and Proton. Let’s ride along with the game now, from launch to the first frame, and see where each name makes its entrance.

The same game.exe, with different layers underneath

Windows Linux · Steam + Proton Game
game.exe the same file, not recompiled
System APIs
kernel32.dll user32.dll …shipped with Windows
kernel32.dll user32.dll …Wine's reimplementations, same names
Graphics API
d3d11.dllDirect3D 11
d3d11.dllDXVK: Direct3D outside, Vulkan inside
GPU driver
Windows driverAMD · NVIDIA · Intel
Vulkan driverMesa RADV · NVIDIA …
Kernel
Windows NT
Linux
Hardware
x86-64 CPU · GPU the same machine

identical on bothstand-ins supplied by Proton

A Direct3D 11 game. The game and its CPU instructions stay the same; the layers in between change. The game still loads files named kernel32.dll and d3d11.dll, but receives the Wine and DXVK versions.

The CPU understands it. Why can’t the system run it?
#

Suppose you copy a Windows game’s game.exe straight onto a Linux machine. Both are x86-64, so the CPU understands the machine instructions inside. Does an addition stop being an addition, or a jump stop being a jump, just because the operating system changed?

No. And yet the game still won’t run directly, because a game is more than arithmetic. It has to be loaded into memory and find its libraries; then it opens files, creates windows, reads the controller and sends drawing work to the GPU. All of that relies on agreements between the program and its environment, and game.exe only ever signed those agreements with Windows.

Inside game.exe: which parts does the CPU understand?

game.exe PE32+ · x86-64
PE headers
MZ … PE\0\0
entry point · section table · import directory

Needs a loader that reads PEThe Linux kernel loads ELF; it does not understand this format.

.text
mov   eax, [rbx+8]
add   eax, 1
call  [CreateFileW]

Runs directly on the CPUx86-64 is x86-64: arithmetic and jumps behave the same. But the call target is not in this file.

Import table
KERNEL32.dll  CreateFileW
USER32.dll    CreateWindowExW
d3d11.dll     D3D11CreateDevice

Needs these DLLs to existand to behave like Windows. The native Linux environment does not supply these Windows DLLs.

Simplified; most sections are omitted. The call in .text reaches CreateFileW through the import table. The CPU can execute the call, but cannot conjure the code it jumps to.

Agreement one: how a file becomes a running program
#

Windows .exe and .dll files use the PE (Portable Executable) format. A header at the start records the entry point, the sections, and which functions to import from which DLLs; the .text section holds machine code and .data holds initialised data. If you want every field, Microsoft’s PE specification has them.

Native Linux programs use ELF. Run ./game.exe in a terminal and the Linux kernel, not recognising the format, will usually just reply Exec format error (unless your system is set up to open .exe files with Wine). Renaming the file won’t help: the contents themselves have a different structure.

Agreement two: who provides system services
#

Picture a simple scenario. When a game loads a save, it does not touch the disk itself. It calls CreateFileW in kernel32.dll; to open a window, it calls CreateWindowExW in user32.dll. These Windows APIs spell out the rules in detail: how arguments are laid out, how strings are encoded, what comes back on success and which error code is set on failure.

The PE import table says, in effect, “I need CreateFileW from KERNEL32.dll.” Trouble is, the native Linux environment does not supply Windows’ kernel32.dll. And even if it did, Linux’s way of opening files (open, file descriptors, errno) and Windows’ (drive letters, HANDLEs, GetLastError) are two different worlds.

While we are here, it helps to separate an API call from a system call. Here, a Windows API is a function exported by a DLL; a system call is the step into the operating-system kernel. On Windows, CreateFileW passes through ntdll.dll and then into the NT kernel, while plenty of APIs, such as string handling, never touch the kernel at all. Most ordinary games request services through these DLLs. Wine provides compatible interfaces and the required kernel-service behaviour without booting an entire Windows kernel.

Bottom line: executing CPU instructions is only the starting line. What has to be supplied is the entire set of DLLs the game assumes will be there, down to their quirks.

Wine: familiar interfaces in a different environment
#

Wine began in 1993. Its name expands to Wine Is Not an Emulator. Notice anything? The first word of the expansion is Wine again, so you can keep expanding it forever, like a set of nesting dolls. A name that contains itself is a recursive acronym, a classic open-source joke: GNU stands for GNU’s Not Unix.

The name is more than a joke, though; it describes the approach. When CPU instruction sets differ, an additional emulator or instruction translator is needed. Emulators can also use dynamic compilation rather than interpreting each instruction. In the matching-instruction-set case discussed here, Wine usually needs no translation of ordinary CPU instructions, and the game’s machine code can run directly on the CPU. What Wine does instead is rewrite the Windows DLLs itself: its own kernel32.dll, user32.dll, ntdll.dll, gdi32.dll and so on, with exactly the same names and interfaces as Windows, implemented on top of Linux.

Enough talk. Here is a simplified view of Wine handling one file open, there and back:

Tracing one CreateFileW: the game opens a save

  1. game.exe
    CreateFileW(L"C:\\Saves\\slot1.sav", GENERIC_READ, …)

    The game believes it is on Windows: Windows path, Windows API.

  2. Winekernel32 → ntdll
    C:\Saves\slot1.sav
      → …/compatdata/<AppID>/pfx/drive_c/saves/slot1.sav

    Map the drive letter to this game's own folder. Windows paths ignore case and Linux paths do not, so Saves must match the saves that actually exists.

  3. wineserver→ Linux kernel
    openat(…, "…/drive_c/saves/slot1.sav", O_RDONLY) = 23

    wineserver performs the actual open and gets file descriptor 23 from Linux.

  4. Winewineserver
    fd 23  ↔  HANDLE 0x1a4

    Windows programs expect a HANDLE, not an fd. In the same step wineserver allocates a HANDLE that refers to the file, used by later ReadFile and CloseHandle calls.

  5. game.exe
    hFile = 0x1a4

    The game receives what looks like an ordinary Windows HANDLE.

Paths follow a Steam Proton prefix; numbers and system calls are conceptual, not an actual trace. The real path also translates access rights, sharing modes and errors: a missing file must come back as Windows' ERROR_FILE_NOT_FOUND, not Linux's ENOENT.

One innocent-looking CreateFileW, and Wine already has to deal with drive letters, case sensitivity, mapping file descriptors to HANDLEs, and translating error codes. File objects, sharing modes and other state requiring coordination are managed with the help of wineserver, which plays part of the role of the Windows kernel’s object manager.

Now multiply that by tens of thousands of Windows API functions. Wine has been at it since 1993 and still isn’t done. Worse, programs rely on undocumented behaviour, quirks of particular Windows versions, and sometimes Windows’ own bugs (a mountain of technical debt, you might say), all of which Wine has to faithfully reproduce. It may be one of the most patient projects in software.

Games speak another language: graphics APIs
#

Great, the window is open. Unfortunately it is also black.

A game engine talks to the GPU through a graphics API: it uploads meshes and textures, sets rendering state, and asks for batches of triangles. Most Windows games speak Direct3D, the 3D part of DirectX, while Linux 3D graphics stacks commonly expose OpenGL and Vulkan.

So on top of the system APIs, the graphics API needs an interpreter too: the game speaks Direct3D, and the compatibility layer has to turn that into something OpenGL or Vulkan understands.

WineD3D: a route through OpenGL
#

Wine has long had its own interpreter, WineD3D, which implements Direct3D on OpenGL. Many older games first ran on Linux thanks to it, and it is still around: in Proton’s settings, PROTON_USE_WINED3D=1 switches back to it for Direct3D 9 to 11.

The trouble is that the two APIs think differently. The resource management, state objects and multithreading of Direct3D 10 and 11 have no direct equivalent in OpenGL, so WineD3D has to improvise, and shaders must first be turned into GLSL text that the driver then compiles from scratch. When features are hard to map efficiently, the result can be dropped frames or broken rendering. Outcomes still depend on the game, driver and WineD3D version, rather than simply the age of the game.

Vulkan: making GPU work explicit
#

Then came Vulkan. Khronos revealed it in 2015 and released Vulkan 1.0 on 16 February 2016. Compared with OpenGL, Vulkan hands back to the application many decisions the driver used to make quietly behind the scenes: how memory is allocated, when commands are submitted, how resources are synchronised.

For a compatibility layer, this was huge. All the bookkeeping a Direct3D 11 driver used to do in the background could now be done by the layer itself, on Vulkan, following Direct3D’s rules instead of wrestling with OpenGL’s assumptions. Vulkan still knows nothing about Direct3D, so an interpreter is still needed, but now it has much better tools.

Shaders: graphics calls are only part of the job
#

Even with every Direct3D call translated to Vulkan, we are only halfway there. Draw calls tell the GPU what to draw; shaders tell it how to compute each vertex and each pixel.

Say a game draws a wall lit by a torch. The mesh and textures are just data, but “where does this vertex land on screen” and “what colour is this pixel in the firelight” are small programs running on the GPU: shaders. A game can contain thousands of them, and Direct3D games commonly ship compiled results from the Direct3D toolchain.

So shaders need translating as well. The diagram below follows a single shader from the moment it is written to the moment it runs on the GPU, and counts the formats it passes through:

The formats one shader passes through

Developer's machine Shipped Player's machine HLSL developer source, usually not shipped ↓ compiled by fxc / dxc DXBC / DXIL bytecode in the game files ↓ translated by DXVK / vkd3d-proton SPIR-V intermediate format for this Vulkan path ↓ compiled by the driver GPU code compiled for the target GPU and driver DXC shortcut · needs source
A common path for games shipping precompiled shaders. Without HLSL source, the shortcut is unavailable: the layer starts from DXBC/DXIL, translates to SPIR-V and hands it to the driver. Older D3D8/9 also have other shader formats and fixed-function paths.

From HLSL to the bytecode inside a game
#

For newer programmable shader paths, Windows game shaders are usually written in HLSL and compiled on the developer’s machine with fxc or dxc. What ships with the game is compiled bytecode: DXBC from the older toolchain, DXIL from the newer Direct3D 12 one. In other words, players commonly receive bytecode; the compatibility layer cannot assume the HLSL source is also supplied.

This is the biggest difference between a compatibility layer and a port. A developer porting their own game can consider recompiling HLSL with tools for the target platform, adjusting the code where necessary. Proton faces a released game that may not have been touched in years. For games that ship only precompiled shaders, it must work from that bytecode. It is a bit like translating a printed book into another language when the author’s manuscript is long gone.

(Strictly, DXBC is also the name of a container format, and DXIL is stored inside it; see LLVM’s notes. So “D3D12 means DXIL” is not exact: some Direct3D 12 games still use DXBC.)

Why does Vulkan need SPIR-V?
#

In the common translation path discussed here, Vulkan receives SPIR-V, rather than DXBC or GLSL source. SPIR-V is a shader intermediate representation defined by Khronos: lower level than source code, but not yet tied to a particular GPU. The driver compiles SPIR-V into its own GPU’s machine code.

The compatibility layer’s job is therefore the highlighted arrow in the diagram: DXBC/DXIL → SPIR-V. Both sides are structured bytecode, so this avoids the extra step of emitting GLSL source for the driver to parse again. Types, resource binding and edge-case behaviour still differ, though, so it is not a dictionary lookup.

Shader and graphics-pipeline compilation are important sources of shader stutter: if compilation remains on the critical path when a frame is needed, that frame can arrive late. Caching and precompilation reduce these stalls but cannot guarantee stutter-free play. Steam’s Shader Pre-Caching uses collected shader and pipeline data to reduce runtime compilation. Fossilize records and replays Vulkan objects so the driver can build a local cache in advance. This is not simply a download of GPU machine code that works unchanged on every system.

An open compiler and translation for existing games
#

You might be wondering: if there is a tool that compiles HLSL straight to SPIR-V, why not use it? There is one. Microsoft open-sourced the DirectX Shader Compiler (DXC) in 2017. Built on LLVM and Clang, it compiled HLSL to DXIL, and the community later added SPIR-V output. For developers who have the source, DXC is the dashed shortcut in the diagram.

But that DXC compilation path needs source code, which players usually do not have. The road that starts from bytecode still has to be travelled by the translators built into DXVK and vkd3d-proton.

DXVK and vkd3d-proton: connecting graphics to Vulkan
#

With the targets in place (Vulkan and SPIR-V), it is finally time to meet the two projects that do the actual translating.

DXVK, written by Philip Rebohle, provides d3d9.dll, d3d10core.dll, d3d11.dll, dxgi.dll and related files (plus d3d8.dll since version 2.4). Internally it implements Direct3D 8 to 11 on Vulkan, complete with its own compiler that turns DXBC (and D3D9-era shader bytecode) into SPIR-V. In Proton, D3D8 generally uses Wine’s implementation by default. PROTON_DXVK_D3D8=1 enables DXVK; version and compatibility settings also affect the choice. vkd3d-proton, a fork of Wine’s vkd3d, focuses on Direct3D 12 and turns both DXBC and DXIL into SPIR-V.

The DLL a game loads decides the route

Direct3D 9 – 11 Direct3D 12 Fallback · D3D 9 – 11 Game loads
d3d11.dllalso d3d9, dxgi …
d3d12.dll 
d3d11.dllopt-in only
Handled by
DXVK
vkd3d-proton
WineD3D
Into
Vulkan
Vulkan
OpenGL
Linux graphics driver (Mesa, NVIDIA …) → GPU
Proton places the DXVK and vkd3d-proton DLLs in the game's Wine prefix. The game loads d3d11.dll as usual and actually gets DXVK. The route follows the API the game uses; a D3D11 game cannot be sent through vkd3d-proton.

The neat part is that the game has no idea it has been swapped. It loads d3d11.dll as usual, calls D3D11CreateDevice, and gets objects that dutifully follow Direct3D 11’s rules, while every call underneath is quietly arranging Vulkan work. It is the same trick Wine plays with kernel32.dll, applied to the graphics layer. The DXVK and vkd3d-proton READMEs describe what each one currently supports.

The graphics components only handle the picture, of course. Files, windows, input and threads are still Wine’s job, and while the game runs the two kinds of calls interleave constantly.

Proton: bringing many projects into one Play button
#

Wine and later graphics compatibility projects made many Windows games playable on Linux. Before Proton came along, using Wine and the graphics components available at the time often meant a small adventure: install Wine yourself, create a prefix, drop the right DXVK version into it, dig through forums for the mysterious environment variables a particular game needed, and then start over when Wine updated.

Proton folds that whole adventure into a single Steam button. On 21 August 2018 Valve announced a new version of Steam Play that runs Windows games on Linux through Proton. The announcement also mentioned that Valve had brought on the DXVK developer to work on open-source graphics.

What Steam assembles when you press Play

Steam · Play
Steam Linux Runtime a consistent user-space library base
Proton each release bundles and tests these together
  • WineWindows APIs, files, windows, threads
  • DXVKDirect3D 9 – 11 → Vulkan
  • vkd3d-protonDirect3D 12 → Vulkan
  • Mediavideo playback through GStreamer
  • Per-game settingsdefaults for known problems
Wine prefix compatdata/<AppID>/pfx

Each game gets a separate C: drive and registry configuration to reduce interference. Some user directories may still map to the host.

game.exe starts
Simplified. The player sees only the button at the top. Steam picks a Proton version for the game, creates the prefix, and starts the game inside the container.

Proton itself is a fork of Wine, bundled with DXVK, vkd3d-proton and media components, with each release tested as a whole. Steam creates a separate prefix for every game, reducing the chance that game A’s settings interfere with game B. Newer Proton versions also run inside the Steam Linux Runtime container: this provides a more consistent user-space library base across distributions and makes problems easier to reproduce. GPU drivers and the kernel still depend on the host. The Steam Runtime documentation explains the environment.

None of this is Valve’s work alone. The Wine community has thirty years of implementation behind it; CodeWeavers develops Proton jointly with Valve, with Valve’s funding; and the developers of DXVK, vkd3d-proton and Mesa’s drivers hold down the graphics end.

The Steam Deck puts the stack in a handheld
#

The Steam Deck, released in February 2022, runs Linux. Its SteamOS 3 is based on Arch Linux; SteamOS 1 and 2 were based on Debian. The full configuration is in the Steam Deck’s specifications.

The Deck brought Proton into a handheld for mainstream players, who could use it every day without needing to know its name. Plenty of people may have owned a Deck for months without realising they were running Linux. Valve added “Deck Verified” ratings, testing games one by one on the Deck and turning compatibility problems into something developers could see and were willing to fix. To check whether a game you want to play works with Proton on Linux, look it up on ProtonDB, where a large number of players report how their games run.

Proton isn’t Deck-exclusive, of course; Steam on any Linux desktop can use it. What makes the Deck special is that hardware, drivers, operating system and Proton can be tuned together, against a small, relatively fixed set of hardware configurations. LCD and OLED models still have hardware differences.

From Wine to the Steam Deck: where the paths meet
#

Looking back, this is really a story of three tracks: Wine handles the Windows environment, the graphics projects handle drawing and shaders, and Valve integrates components, drivers and the playing experience. They started in different places and ended up meeting at the same one.

Three tracks meeting at the Steam Deck

Windows environment Graphics and shaders Steam integration

  1. Wine development begins
  2. Wine 1.0 released
  3. Vulkan 1.0 (uses SPIR-V)
  4. DXVK runs D3D11 games on Vulkan
  5. Steam Play adds Proton
  6. vkd3d-proton handles D3D12
  7. Steam Deck launches
Only milestones relevant to this article. Wine and WineD3D supported many games before Vulkan. Vulkan later provided another graphics translation target. Valve integrated Proton in 2018, with vkd3d-proton improving D3D12 support in later releases.

Why do some games still fail?
#

By now you can probably guess: a compatibility layer has to reproduce everything a game actually depends on, not just graphics. The usual sticking points:

  • Anti-cheat: Easy Anti-Cheat and BattlEye have supported Proton since 2021, but each game’s developer has to flip that switch. Anti-cheat that relies on a Windows kernel driver (scanning memory from inside the kernel) needs a Windows kernel to load its driver into, and there is no Windows kernel underneath Wine, so those solutions are currently unsupported by Proton and need a compatible approach from their vendors. Valve’s Proton developer documentation lists these considerations.
  • Launchers and video: a bundled login launcher, DRM, or cutscenes in an obscure codec can knock a game out before it reaches the main menu.
  • GPU and driver: DXVK and vkd3d-proton require specific Vulkan features. Older cards or drivers that lack them cause trouble, especially for Direct3D 12 games.
  • Updates and regressions: an update to the game, its launcher, the driver or Proton can break a combination that worked perfectly yesterday.

Performance has to be judged game by game too. Translation costs some CPU time, and shader or pipeline compilation can cause stutter; yet in some benchmarks, on some hardware, games running through Proton have even beaten Windows. “An extra layer” does not mean “a fixed percentage slower”.

The next time you press Play
#

Back to that one press, using our Direct3D 11 example. Steam picks a Proton version, prepares the prefix and launches game.exe. The CPU runs the game’s instructions directly; the kernel32.dll the game calls was written by Wine; its d3d11.dll is really DXVK, turning draw commands into Vulkan and shaders into SPIR-V; and the Vulkan driver compiles them and sends them to the GPU. When things go smoothly, the title screen lights up after a few seconds. The compatibility components continue working throughout the game.

And just like that, a game with no Linux release stays in your library, instead of being given up because you switched operating systems.

So next time you press Play on Linux, spare a thought for what is behind that button: Wine, filled in one API at a time since 1993; Vulkan, which finally gave the interpreters decent tools; DXVK and vkd3d-proton, chasing down one game after another; and Valve, which assembled it all into a single button.


If you enjoyed this article, I highly recommend watching SteamDeck 搭载 Linux,凭什么可以玩 Win 游戏?, a Chinese-language video by Redknot-乔红. Watching it is what made me want to write up the technology behind Proton. Technical details and dates were checked against the project documents and original announcements linked throughout; the diagrams are conceptual and leave out some components and calls.