Valve has made Dota 2‘s Direct3D to OpenGL translation layer open source. This is the piece of code that allows Valve to take a standard DirectX Windows game that uses the Source engine (Dota 2, Team Fortress, Portal), and easily bring it over to Mac OS X or Linux/SteamOS. The code, with some tweaks, could also be made to work with other DirectX-based game engines as well. By open-sourcing this code, Valve is clearly encouraging developers to release OS X — and more importantly, SteamOS — ports of their Windows games.

The code, aptly named ToGL, was uploaded to GitHub by Valve developer Pierre-Loup A. Griffais — a fantastic name that he sadly abbreviates to Plagman. ToGL is taken straight from the Dota 2 source tree and supports a subset of Direct3D 9.0c, bytecode-level HLSL to GLSL (shader) translation, and some Shader Model 3 (SM3) support. The code is provided as-is and completely unsupported; Valve says you’re free to use it however you wish, and you can submit modifications to the GitHub repository if you like.

If you’ve ever heard of Wine or Cedega — emulation software for running DirectX games on Linux — then ToGL is similar, but different. Basically, almost every Windows game has a graphics engine — and that engine uses specific APIs (functions) provided by Direct3D. Direct3D, which interfaces between the game and the GPU, is only available on Microsoft platforms (Windows, Xbox). ToGL intercepts the calls to Direct3D, replacing them with the OpenGL equivalent. There’s a performance hit, of course, but it’s small. (I’ve played Dota 2 and Left 4 Dead 2 on OS X, and it runs just fine.)

Now, considering this only supports Direct3D 9.0c, ToGL isn’t going to suddenly allow newer Direct3D 11 games to be brought over to Linux/OS X (unless they have DX9 legacy support, of course). What it will do, though, is allow big studios to re-release older titles on OS X and Linux/SteamOS — and if there are any indie developers out there who develop games in DirectX, they obviously stand to gain as well. Let’s not forget that Valve rather famously said back in 2012 that OpenGL is faster than DirectX, even on Windows, too.

At the very least, Valve is probably hoping that the release of ToGL will increase the number of games available for its nascent SteamOS. Of course, if it also kick-starts an open-source effort to create a translation layer for D3D 11 and 12, that would be a very good thing as well. It will also be very interesting to see which graphics APIs Valve supports with its upcoming Source 2 engine, which will probably be released alongside Half-Life 3.

(Incidentally, a fun fact: Titanfall, which is released today, uses the Source engine — and it’s the first game to use the Xbox One version of the Source engine.)