Microsoft brings DirectX 12 to Linux, with many "buts"

Microsoft brings DirectX 12 to Linux, with many "buts"

With a completely unexpected announcement Microsoft reported the arrival of the graphical APIs DirectX on Linux. DirectX are used under Windows both by games and by applications that perform calculations using the GPU. At first glance, the news appears extremely positive for developers, the Linux ecosystem, the Windows ecosystem and users; digging a little deeper, however, it turns out that they are there limitations and specific stakes in the current proposed implementation.

DirectX on Linux: how they work and why they have been implemented

The news of the arrival of DirectX on Linux generated – understandably – enthusiasm in many users: the first rumors claimed that it was a porting of APIs and libraries connected to the penguin's operating system. Not so: Microsoft brought DirectX 12 to Linux like part of the Windows Subsystem for Linux 2 project (or WSL2 for brevity), as explained on the official blog. It is an implementation of Linux through virtual machines within Windows: the user can thus use applications written for Linux directly from Windows, without having to configure his own virtual machine or a complete installation.

Thanks to this implementation of DirectX it will be possible use applications that exploit OpenGL and OpenCL, with Vulkan and CUDA coming soon in the future, within the Linux virtual machines used by WSL2. This is because calls to these APIs will come converted in real time to DirectX calls, then managed by Windows.

To make this happen, however, Microsoft is asking that the code to take advantage of DirectX 12 under Linux be integrated directly into the kernel. In this way it would then be possible to install a Linux distribution (Ubuntu, Fedora, SUSE) in WSL2 and take advantage of the new features without the need to install particular packages or having to intervene on the configuration.

Read This Now:   The RTX 3080 Ti will be a power monster, but the RTX 3070 isn't a joke either

The motivation behind this DirectX implementation is explained by Sasha Levin, kernel hacker who works in Microsoft and who has taken care of creating the necessary code for this functionality, in the mailing list of the Linux kernel:

"There is only one use case for this [funzionalità]: a developer working with WSL2 who wants to perform machine learning on their GPU. The developer is working on his laptop, which runs Windows, and this laptop only has one GPU that Windows is using. Since the GPU is used by Windows, we cannot directly assign it to guest Linux, but we must instead use the GPU partitioning to give access like guest to the GPU. This means that the guest it must be able to "speak" in DirectX 12, which is why we pulled DX12 into Linux. "

In fact, the implementation chosen by Microsoft works as a conduit that passes the instructions from the Linux virtual machine to the underlying Windows physical machine: therefore it is not a real port of DirectX to Linux, but rather a way to make GPU use possible without all theoverhead virtualization (which leads to a significant impact on performance). At the moment, there is no possibility to exploit the GPU to display graphic applications: it is possible to use it just to make calculations.

Microsoft therefore intends to give developers the opportunity to use Windows as an operating system also to develop applications for Linux that use the GPU, which has not been possible so far with WSL.

DirectX on Linux: a more open future on the horizon?

DirectX 12

For some time the availability of graphic libraries on various systems has been causing compatibility problems: on the one hand there is Windows with support for DirectX, OpenGL, OpenCL and Vulkan; on the other there is Linux with OpenGL, OpenCL and Vulkan; then there is macOS that makes its own story with Metal.

Read This Now:   What after death? Maybe a new life in the metaverse?

The Microsoft platform is the one that offers compatibility with the largest number of APIs, while Linux uses DXVK and similar projects to perform a "translation" from DirectX to Vulkan and still be able to take advantage of the Microsoft APIs. macOS makes history in itself and refuses support to any API that it does not control, which is why projects such as MoltenVK were born to exploit the Vulkan libraries also on macOS.

The fact that many applications, from professional to playful ones, are written to take advantage of DirectX and that there are no alternatives makes it impossible to take full advantage of them on Linux. However, Microsoft developer Steve Pronovost suggests, in one of his posts in the Linux kernel mailing list mentioned earlier, that Microsoft could bring DirectX to Linux natively in the future:

"We considered bringing the DX [DirectX] on Linux without keeping them attached to the umbilical cord of Windows. I'm not ready to talk about it now … but in the hypothetical case in which we did this thing, the DX would be performed on DRI / DRM [Direct Rendering Management, il gestore della grafica nel kernel Linux] on Linux natively. […] In this hypothetical world, in practice we would have the DX that point towards the DRM on native Linux machines and the DX that continue to point towards DXG in WSL to share the GPU with thehost. "

The clear message is that Microsoft is thinking of a native porting of DirectX to Linux. This has led many in the Linux community to wonder if the company will do it with an open approach, making at least a part of DirectX open source, or if the company will keep them closed, however leaving the possibility of using them with a special driver.

Read This Now:   the smart screen with Alexa

In any case, the issue is relevant for both private users and companies, albeit for different reasons. Being able to develop directly from Windows with a target Linux also exploiting the GPU of your computer opens up interesting scenarios for simplifying the management of the fleet; the greater integration between Windows and Linux represents a plus not insignificant that it can bring together the best of two worlds. There is no doubt that the philosophies behind the two systems are different and companies must evaluate which of the two can bring more benefits, also based on the skills present internally, when they choose the operating system to be adopted for their projects.

From the user point of view, however, the message about the possible porting of DirectX is perhaps the most important passage of the story because it would open the use of games without particular penalties from a performance point of view.

In any case, this move by Microsoft seems to go in the direction of confirming what President Brad Smith had said a few days ago: "we were wrong on Linux and open source". The most fervent supporters of the open model and Linux are waiting for developments to see if this is true and, in one sense or another, however, something seems to have changed in Microsoft.


Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/gamefeve/bitcoinminershashrate.com/wp-includes/functions.php on line 5420

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/gamefeve/bitcoinminershashrate.com/wp-includes/functions.php on line 5420