NAG Online > News > Valve releases the tools used to port Source games to Linux

Valve releases the tools used to port Source games to Linux

Steam on Linux penguin header

Good guy Valve has played another of the cards in their hands and has released a tool to the Linux community that allows game developers to port games based on DirectX to OpenGL. Creatively named “ToGL” (can be pronounced as “to GL” or “toggle”), Valve’s tool is a shim that translates DirectX calls to OpenGL in a similar fashion to WINE, but it doesn’t work in the same way as WINE. ToGL is the same tool that Valve used internally to port over their Source-based games to Linux to assess how viable development and optimisation would be and ended up porting the Source engine into Linux entirely.

Valve has been very open about how they’re working the move to open-source software and just like their other initiatives like SteamOS, ToGL is completely open-source and free to download and fiddle with. The source code is available on Github although it hasn’t been published in its entirety. There are parts of it still missing that Valve has to work on before adding it to make ToGL fully featured. Valve also warns that ToGL is still extremely experimental and that some parts of ToGL still have pieces of the Source engine inside.

Inside the notes on ToGL on Github, Valve warns that ToGL is merely a translation layer and that it isn’t perfect. It doesn’t , for example, support all the features in DirectX 9.0c because many of those features are hardware dependant. On a binary level it does have a translator that handles the transfer of the HLSL shader code to GLSL, which makes it like AMD’s Mantle which translates HLSL, found in DirectX, to a format readable and addressable by the Mantle API. There is also some support for Shader Model 3 which has been in most GPUs since 2009.

Valve says that ToGL is provided to the community as-is and it will be unsupported by the gaming giant. Game developers can use it for reference, incorporate it into their projects or make modifications to the source code to help others. The licence for ToGL is only 23 lines long and basically says it’s free as in free beer. ToGL is currently implemented in DOTA2 by Valve.

Game developers using ToGL may find it a useful tool to assess how things would run on the Linux platform and it may provide a much deeper level of control than running things through WINE. The difference compared to WINE, though, is that WINE is a translation layer that works on the fly in real time to translate DirectX calls into something that Linux drivers and OpenGL can understand.

ToGL, meanwhile, is run when you’re building the final code for testing and is pre-baked into the software, bringing it closer to native code. Although you may see a performance dip because of the lack of features and the lack of support for DirectX 9 in its entirety, it may still be a better performer than WINE on the same hardware.

Source: Github (via Anandtech)

Discuss this in the forums: Linky

Tags:  , ,
  • Byron Will-Noel

    Any word on how easy the port is to do?

    • Wesley Fick

      Considering they provide the tools as-is and tell you to use at your own risk, I’d say fairly difficult if you don’t know what you’re doing. If any devs were targeting Linux already, I don’t think they’d be making their game first on DX and then trying to figure out how to move to GL from there. This is just to mainly help older ports get onto the Linux platform with less work.


Login / Search

Latest games

Latest opinions