Direct3D 9 Support Released For Linux Via Gallium3D, Running Games

Back in 2010, Direct3D 10/11 was natively implemented for Linux in the form of a Gallium3D state tracker. While Gallium3D is most often associated with OpenGL, its API agnostic and handles OpenGL ES, OpenVG, and even OpenCL for compute support, among other interfaces. Gallium3D can work just as well with Direct3D, but there has traditionally been not much developer interest in such a state tracker. This isn't to be confused with a translation layer whereby Direct3D commands are mapped into OpenGL.
The Direct3D 10/11 state tracker excitement was ultimately shortlived as the upstream Wine development community wasn't interested in adding support for it since it's a Linux-only solution and at that it's limited to those using Gallium3D, which is basically the open-source Radeon and Nouveau (NVIDIA) users. This D3D 10/11 state tracker was ultimately removed from Mesa since it wasn't being used and the code was suffering bit-rot.
Christoph Bumiller, a developer associated with the Nouveau graphics driver project, on Tuesday announced a Direct3D 9 state tracker. While D3D 10/11 support was short-lived, Bumiller believes the D3D9 situation is different. Christoph is actively maintaining this code (at least for now), it's written in C rather than C++, Gallium3D is better suited towards D3D9 at the moment than the newer versions of Microsoft's graphics API, there's more application coverage for D3D9, and most importantly this state tracker is in a working state where Direct3D games/applications can actually run.
Since Linux-native applications are using GL/GLES over D3D, Christoph modified Wine to use this D3D9 state tracker over the project's internal D3D-to-GL translation layer. With a patch atop Wine, the Direct3D 9 state tracker can work so that the graphics API is natively implemented for the hardware Gallium3D drivers rather than just translating the API calls into OpenGL.
Christoph says right now that Skyrim, Civilization 5, Anno 1404, and StarCraft 2 are among the D3D9 games now running on Linux. Testing has happened from the Nouveau NVC0/Fermi and AMD Radeon R600g drivers. The performance is reportedly quite good and can be up to two times better than the frame-rate when using Wine's current code.
This state tracker for now is being housed in an external Mesa repository but he's open to merging it to master if there's interest. The Wine changes for now are also in a separate repository. The announcement concerning this new state tracker can be found on Mesa-dev.
It will be interesting to see if this Direct3D 9 state tracker takes off for Linux and whether Wine developers will optionally support it for better performance.
97 Comments