The New Wine Vulkan Backend For DirectX 9-11 Is Coming Along Nicely

From LinuxReviews
Jump to navigationJump to search
Exec wine.svg

The Wine Is Not an Emulator compatibility layer for running Windows software on GNU/Linux machines has long had a built-in OpenGL compatibility layer for games and other software using Direct3D 9-11. There is also an alternative compatibility layer for Direct3D 9-11 called DXVK available which translates Direct3D calls to Vulkan instead of OpenGL. DXVK is written in C++ and it is kind of a mess. The Wine developers have secretly been working on their own Direct3D 9-11 to Vulkan translation layer written entirely in beautiful C. This new wined3d Vulkan renderer is now at a point where it can be used to perfectly run some Direct3D 10 games.

written by 林慧 (Wai Lin) 2020-07-15 - last edited 2020-07-21. © CC BY

MGI under Wine3D Vulkan 01.jpg
Monster Girl Island running under Wine using the new Vulkan Direct 10 renderer and a MangoHud overlay showing details about the systems Vulkan rendering back-end.

Wine has had a great built-in DirectX 12 to Vulkan translation layer (vkd3d) and a layer for running Windows Vulkan programs on other platforms with Vulkan-support (wine-vulkan) for quite some time. The built-in Wine translation layer for Direct 9 to 11 has, and still is by default, been translating draw calls to OpenGL.

The road to a fully functional built-in Direct3D 9-11 to Vulkan Wine translation layer has been a long one. Actual development didn't start until early 2019, mostly due to a lack of resources.

"The bottom line is that the answer to the question why this didn't happen sooner is mainly that between the public release of Vulkan and now, we didn't have the resources. There were a few other considerations that might have played a role if we had had the resources, like the lack of stream output / transform feedback in Vulkan (now resolved), Vulkan pipeline compilation speed, and a few others, but those are all moot as long as there's nobody to do the work."

Many Linux gamers who want something performing better than the Wine DirectX to OpenGL translation layer have opted to use the third party DXVK DirectX 9-11 to Vulkan translation layer. It works, and it works quite well for a lot of games. DXVK development has been quite stagnant for quite some time. It is essentially in "maintenance mode". Some may wonder why the Wine team didn't simply integrate DXVK into the core Wine project and kick-start development. Doing so would not have been as easy as it sounds:

"On first sight, you might say DXVK is written in C++, uses a non-copyleft license and duplicates a bunch of existing Wine code for no good reason, while Wine would obviously prefer C, LGPL, and something that fits into the existing architecture of Wine. I.e., at the outset, these really aren't the design decisions you'd make if your goal is to eventually become part of the Wine project."

The Wine developers opted for writing their own DirectX 11 to Vulkan translation layer in pure C. This work is nowhere near complete but the new wined3d vulkan renderer is at a point where it can be used to play actual games.

Enabling the built-in Wine DirectX 9-11 To Vulkan Translation Layer

Wine-regedit.jpg
The wine3d3 vulkan renderer can be enabled by changing a registry key using wine regedit

We could not figure out how to enable the wined3d vulkan renderer our own so we reached out to the Swiss Wine developer Alexandre Julliard who quickly responded with a link to Useful Registry Keys.

The wined3d Vulkan renderer can be enabled by changing the Wine registry key HKEY_CURRENT_USER ▸ Software ▸ Wine ▸ Direct3D ▸ renderer to vulkan. Run wine regedit and click on and expand HKEY_CURRENT_USER and Software and Wine and finally Direct3d. Right-click in the settings area and select New ▸ String value. Call your new string renderer. Click on your new renderer string and give it the value vulkan. You can remove this key or change it to gl to switch back to the OpenGL backend.

You will need a fairly new Wine version to get good results with the wined3d Vulkan renderer. You should probably not bother if you have Wine 5.4 or older. The latest version is, as of toady, Wine 5.12. You can run wine --version to see what version you have.

Wine will echo a line similar to

00c8:err:winediag:wined3d_dll_init Using the Vulkan renderer.

in the terminal when the DirectX 9-11 to Vulkan translation layer is used. That line will, instead, say

0024:err:winediag:wined3d_dll_init Using the OpenGL renderer

if OpenGL is used.

There will be no difference if a game uses OpenGL or Direct3D 12 (you can check with WINEDEBUG=+loaddll wine game.exe), this will only affect software using Direct3D 9 to 11.

A few DirectX 10 programs run just fine, with no issues at all, using the wined3d vulkan renderer. Most DirectX 9 and 11 programs will simply not run at all.

GrayArea Wine.jpg
The game "Gray Area" "Failed to create Direct3D Device" using wined3d Vulkan.

Your mileage will vary depending on what game or program you try. There is a reason why Vulkan has not yet been made the default renderer.

MGI under Wine3D Vulkan 02.jpg
Monster Girl Island running with the Wine wined3d vulkan renderer. A MangoHud overlay in the upper left corner shows details about the Vulkan performance.

Monster Girl Island was one of the games that works perfectly when the built-in Wine Direct3D to Vulkan translation layer is used. It uses Direct3D 10. The Vulkan support for Direct3D 10 seems to be better than it is for 9 and 11.

Wine-error.jpg
TastyRamen Episode1 Beta, available from itch.io, will give you such Error and such failure to initialize graphics when the wined3d renderer is used.

Several random Windows games from itch.io like TastyRamen Episode1 Beta, Siren Head and Slay Bells refused to run using the wine3d3 renderer.

The scene demo "Patterns Of Chaos" by Aesrude, released at the 7DX Demo Party in 2011, produces a wonderful "Program Error Details" box when Direct11 Vulkan rendering is enabled:

Patterns Of Chaos Wine Vulkan.jpg
Very informative error displayed when the "Patterns Of Chaos" from 2011 is ran in Wine with wined3d vulkan rendering.

Both the popular fr-025 demo and the fr-041 "debris" demo exits with a fine 0024:fixme:winediag:wined3d_select_feature_level None of the requested D3D feature levels is supported on this GPU with the current shader backend. message in the console. Both work great when the OpenGL renderer is used.

Fr-041-debris-01.jpg
The popular fr-041-Debris Directx 9.0c demo running in Wine using the OpenGl renderer - because it simply won't run using the Vulkan renderer.

Direct3D 9-11 Rendering Could Be Ready For Wine 6.0

The current state of the Wine Direct3D 9-11 to Vulkan back-end is far from a point where you should immediately switch to it and never look back. A lot of software will simply not run when it is enabled. However, those things that do work with it shows that it has come a long way.

It seems likely that Wine 6.0 will have a Direct3D 9-11 to Vulkan translation layer which isn't too far from the Direct3D 9-11 to OpenGL translation layer Wine defaults to using today. If it will become the default renderer or not in that release is another question. It will probably depend on what, if any, problems with it remain in the weeks leading up to the big Wine 6.0 release. You can go ahead and try playing with it right if you want to but you should not expect to be able to run the majority of the programs you try. You are better off either using DXVK or Wines built-in OpenGL renderer if you just want to enjoy Direct3D 9-11 games on a GNU/Linux computer.

0.00
(0 votes)


Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.