Share This article

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.)

Tagged In

Post a Comment

just an assumption, IF they make this for DX11 and or DX12 could these games be played on windows xp? or DX12 on win7.

http://www.mrseb.co.uk/ Sebastian Anthony

Ha, yes, maybe — if those older versions of Windows support OpenGL 3 and 4. (I think they do?)

eonvee375

who gives a shit? We will have LINUX! ^^

but seriously though – good question.

Jordan Pt

Pointless to wonder about XP support, considering that it will be a dead platform in a month. Anybody still running XP after this year is just asking for trouble. If you can’t afford upgrading to Windows 7 than you better ask someone to help you switch to a Linux OS. You’d miss out on some Windows programs, but things like Wine have pretty much mastered running WinXP apps on Linux.

massau

than consider the DX12/win 7 combo , where you can expect that dx12 will be a win 8.2 /9 only release.

Luiz

Are you sure you want to run modern games with an adapter from DirectX to OpenGL with another layer of abstraction and expect it would just run fine on an old machine? just because a modern Linux kernel runs on this old machine. Linux does not do miracles.

Samson

You’re a moron

Luiz

Thanks, your opinion will be put just by side with the trash.

timbuck93

I get f.lux with Wine (couldn’t use a computer without it!) THE **ONLY** thing I need on Linux that isn’t there yet is a GUI to overclock and more importantly CONTROL FAN SPEED of my GPU, until that happens I don’t really want to fold@Home on it, or game with Linux because I’ll burn it out I think!

(If you don’t use f.lux — just start tonight seriously)
Use the slow 60 minute transition and play with the night slider to get it where you want, you’ll eventually adjust to Halogen though!

Mirimon

if coded for dx11-12 etc.. it could do things like allow pc’s to play xb1 games… and to a further extent, it would allow their competition console, the ps4, the ability to play xb1 games…. (pending any built in protection programs from msft in the software..)

massau

that would be cool to play xbox one games on pc but it will probably be used by pirates because it probably won’t be legal.

Dave Wilson

XP just doesn’t have the capacity to support larger systems, so I wouldn’t count on developers jumping at the opportunity to backport newer games, but it is an interesting thought.

eonvee375

i have that Upgrade itch! , cant wait to finally switch to linux ^^

timbuck93

I really like Linux Mint Cinnamon – and here’s why
Right click the desktop and click Add Desklets
Go to the Online Tab
Get the weather widget (NOT accuweather)
Go back to local and add it to the desktop

Right click the widget and click Configure
Change the layout to Vertical
Try the Vclouds theme, and adjust the Zoom to your liking
(I use 2x so I can see it really easily)
Try the border and transparency features of the widget.

While I’m at it, go download the Windows version of f.lux (if you have Linux get Wine 1.5/6 and install that. Then run f.lux setup like normal (don’t use the darkroom mode on Linux) I love f.lux, just try it for TWO weeks and tell me you don’t think it’s absolutely amazing.

I *LOVE* that widget!

eonvee375

i can feel that passion in your message through my screen ^^ (im curently running backbox in VM, the new xfce shell is sick! ^^)

timbuck93

Haha thanks — do ctrl + f and type in timbuck, I did another comment about one single thing holding me back from using Linux – literally ONE thing, and that’s controlling as a bare minimum, the GPU fan speed – I don’t want to burn out my card!

eonvee375

yeah, heard you need to go through scripts yourself to get something workable

timbuck93

Well it turns out yesterday, I basically dedicated the day to using Linux ( I did reboot into Windows one time, but got back in mint)

I got everything set up, Nvidia drivers, Folding@Home, Steam, and not one printer (aggravating).

I also couldn’t scale the DPI in Linux (in Windows 7 you go to Screen Resolution > “Make text and other items bigger or smaller”, I have mine set to 150% but you can actually go a lot higher, I’ve tried 175% and 200% but they seems to be a bit much. I don’t want to run 720p in Linux I want 1080p with a High DPI.

Also, I couldn’t install the network printer, a brother printer, which I had gotten to work in 12.04. Linux just has too many issues for me — if you don’t use f.lux though, go get it, I find it very helpful at night.

eonvee375

i think you can find some 3d party linux drivers on the net if you make some search on google (worked for me so far), but yeah DPI was my concern too when i use a big screen ^^

Ray C

I guess that’s cool an all, but I’m still have trouble understanding the obsession with Linux and Linux porting

eonvee375

i can just tell you are not using command lines very often. ^^

You need to understand how Linux is different from NTFS systems to really enjoy it ^^ I mean im using Windows right now so im not much of a power user myself
but i know for the fact that Linux is way superior in stable networking/partitioning

theres a reason that no one is using Windows as a server OS ^^

Stacey Bright

I’m not quite sure of the context of your last sentence. The windows server platform is actually quite popular. Now if you meant that specifically toward the Windows client OSes, then that is in part due to limitations imposed by MS so that people but the server version instead.

Jordan Pt

I think he meant that Linux is by far the most used Server OS in the world. Windows Server market share compared to Linux, is like iOS market share compared to Android.

Web, Mail, and DNS are a subset of services offered on the Windows platform. There are also a number of them that would/should never be publicly accessible, so wouldn’t make the criteria of that section of the wiki. Also such a testing methodology wouldn’t exclude linux based device that happen to run a web service solely as a form of management interface and not technically a server. For web services in general yes Linux is more popular. I was contesting the quite erroneous statement that no one uses Windows as server OS.

Ray C

I use Linux at work. I do use command line and Linux. My issue is not people using Linux. My thing is people with this ” I hope Linux takes over the world attitude.” There can be a Linux-based platform that is beyond dead, but you will find people commenting on it like one day it will have a great revival. Plus, a lot of the people hoping for the great Linux renaissance aren’t Linux power users. Some of the people who comment on here hope some new Linux-based phone takes off or some new Lindows-type distribution takes off. I’m not saying I have a problem with the use of Linux

Luiz

Yes, I would love to play with my O/S instead of my games (being ironic). No, I prefer my Windows Box, I only install drivers and games and nothing more, and it works perfectly, I removed explorer from starting and disable several services, it is just as clean as a console, then I use a simple launcher. My desktop has turned into a console, but for desktop games. I don’t even care about Linux. I just want to play games.

eonvee375

so wouldnt you prefer a goodOS+games combination rather than shitOS+games one?

plus i said i was using windows too because of games but id prefer running them on a better system… sounds logic to me

Matthew Smit

Windows isn’t really a shit OS. It’s not overly open, but more so then mac is. There have been many issues with it, but there are many issues with all OS’s, I have had as many linux troubles as windows ones.
Until recently a lot of things haven’t been standardized with linux, alsa(sound library) has fixed a lot, and valve is working hard on it.

eonvee375

i know that windows is not that bad (IM USING IT! idk how many times i need to say that ^^) but id still rather go for Linux when it will reach the same bugout support windows received in its long reign

its just an obvious choice for me, i dont condemn the diversity (everybody knows that monopoly kills progress) i just enjoy a fair competition ^^

Luiz

There was never monopoly, sure Microsoft had contracts with the gov and several enterprises, but for consumer market, was always matter of choice, why no one used OS/Warp and choose W95, the hardware was expensive, W95 just runs on any shit, there was only incompetence. Linux was unusable before ~2000, I destroyed several hard disks and lost uncountable hours that if I had worked I would buy several Windows licenses and a good meal. There is Windows, OSX and Linux, there are several form factors, and there’s Android and iOS. No “natural monopoly” lasts forever, it took only ten years for empire to lose its power. Also, by 2005 Linux Desktop graphical interface started being something usable, before that it was barely usable, I would prefer to use Windows 98, even if it crashed 2 times a day than Linux GUI that time.

eonvee375

sorry but PC market was always driven by gaming industry… where are all games at? windows.. where are all users at? windows… here you go, seems like a monopoly to me

Luiz

I would prefer an OS that works, I don’t care about ideology. Windows is a pretty good OS. Who cares if Linux is 5% faster (I just but more hardware, what is more 100 dollars to who spent 800), or don’t get a virus (this is really a user problem, it gets virus, otherwise Android won’t be virus/spyware ridden). I am using a W7 installed on 2010 e never reinstalled it, it is working perfectly fine. Why would I lost my time configuring and learning another. It’s like my car, when it breaks, I just take it to repair shop, I don’t even care if exists a car that never breaks (it don’t exists, all cars break, even the expensive ones someday breaks).

eonvee375

very near sighted point of view but at least its yours and i respect that.

Samson

Pot meet kettle

Luiz

Also, no one is using Windows as a server is lie. It certainly has not more than 20% of the market, but there are several servers, including Microsoft’s own. And there’s the azure running Linux instead Windows, just great. Linux ext2 is shit, NTFS was much better, It took years for ext3 to became slight better than NTFS. But I don’t care, I use hardware RAID, it doesn’t matter much anymore.

eonvee375

not my problem you dont understand what a hyperbole means

Luiz

I saw it after, just didn’t pay more attention. Do several things at once, and none of them correctly. whatever….

eonvee375

at least you are honest ^^ +1

eibon666

Windows has 45% of the server market as of summer 2013, so a great deal of people and companies use it.
For command line joy, Windows has Powershell. For extra cmd utils, they have xp support pack and windows resource kit and so on. And let’s not forget sysinternals.

Danny Lewis

Because Microsoft is trying to lock down Windows to make it more like iOS. If you have ever played with an RT device, you can see just how easy it would be for them to flip a switch and then, all of a sudden, no more programs you can download and install. Everyone would have to go through the Windows Store. Oh, you have a competing web browser? BANNED. You have a competing word processor? BANNED. You say it isn’t fair? Tough, you agreed to the ToS.

Linux is open for all to use.

Ray C

I guess I’m just not that Paranoid about it. There’s is a difference between RT and other versions of Windows. Plus, it’s not like this started just with the release of Windows 8 or RT. People have been waiting for the great Linux takeover for as long as I can remember. They could all lock down their devices and keep certain apps out of their store if they wanted to, so it’s not something that’s just Microsoft specific. The amount of people who would move from Windows just because games are ported is small anyway. I don’t have a problem with people wanting to switch over to Linux or have Linux versions of things they like. I just don’t get this attitude “I hope this product succeeds, so this other group can be destroyed” or ” I want Linux to bring all the makers of proprietary products to their knees .” If I like something, I either buy or use it. I have no reason to root against someone else

eibon666

That’s the worst case scenario for every vendor, and it could happen to Ubuntu too. Someone woud probably fork it or hack it, but still, it’s possible. As it stands now, no competing apps are “BANNED!!” from the store. They know they can’t do that.

Luiz

Actually they don’t need to do that. They have access to internals API to make IE11 runs better than anything on Window RT, and they do that. Simple as that. Also, Surface is their product, not an open platform like PC platform, it Is closed, accept that. Several things are closed, like videogames, no one cares.

trxr

But this is exactly what differentiated Windows from Mac – the fact that there were so many software vendors writing all kinds of of stuff and you could very easily install onto your device from any source. If all MS will offer in future is locked-down tablets, everyone who just wants a simple “browsing” and “apps” device will just buy iPads.

As for IE 11 and their APIs, they aren’t making that great use of them, since IE 11 gives me the shits. Of course. not having a proper Ad-block available doesn’t help.

Luiz

Yes, it is sad. I would love to have an “Armed” Windows as open as Windows 8 on PC. About the IE11 I wish they would use LLVM like compiler on ECMAScript to give it better performance, it is the only thing that is making IE poor performer. But the most likely thing they have is Roselyn compiler, and it is years late in development compared to LLVM, LLVM is great, and Chrome is only fast because of them, Chrome is a big shit otherwise. They also need a better/safe interface for creating Addons, COM is a horrendous shit, why can’t I use safe managed dotnet code on it.

trxr

Yep, I am quite certain that the RT experiment was there to see if people would suck up being locked into a Windows Store. Thank goodness it appears that they weren’t.

It’s a shame, really – the RT tablet is a nice piece of kit, but why the hell did Windows go out of their way to undermine their more open to all-comers sofware ethos (yes, I would like a different browser, a better graphics editor, and to install Putty, thanks), unless it was to “float” the walled garden idea for future deployment across their other consumer OSes?

trxr

I’m a Windows admin, but I prefer Linux at home. And this would enable me to finally ditch Windows on my primary machine altogether, because really what I have it for is gaming.

As to why I prefer Linux, I like the open-source ethos. And with my experience of Windows 8 and the Surface RT tablet, I am horribly suspicious that Microsoft are going to try and pursue a “walled garden” approach with the Windows store and apps on their non-RT OSes as well, similar to Mac, if they think they can get away with it. And I think the Windows 8 interface – the fact there are two operating at once – is a shocker.

I’m happy with Win 7 currently, but unless Windows 9 is a significant improvement on UI design – I don’t mind if there are tablet and desktop modes, but it shouldn’t flip-flop randomly between them – I would rather stick to Mint (Debian) Linux.

Rikard Johansson

Because putting the control of the single most important piece of software on your computer in the hand hand of a single company is just plain wrong. It’s your computer after all, why shouldn’t you own your OS as well? Its not about a OS being Linux-based, it’s about that the norm should use an OS that’s not company-controlled. How would you like having your fridge controlled by a company, so that you can only buy groceries via the owning company? Or being denied putting anything home made into it? That’s the reality we’d that awaits us if we allow companies to roam free.

http://www.something.com/ standard

Oh wow, I hope MS are shitting themselves.

eonvee375

theyve already emptied with the Metro issue ^^

Luiz

They are making a new better DirectX, with better debug support/performance, and compatible with PC/Xbox and they will sell it for a low price. Or they can just make contracts for special exclusive games, like they all do in game industry.

Matthew Smit

DirectX is already better (and always has been?) for debugging. DirectX itself when run in debug mode outputs lots of warnings and errors when you try to do stupid things that the graphics card has to work around.
OpenGL has only recently got a debug output mechanism and even then I almost never get any messages.

There are tools for shader debugging, visual studio now supports it for hlsl apparently, but not much integrated into either api.

infinitas

Like adobe and flash did with HTML5/JS… It’s just a matter of time before MS and DX

…All in due time… All in due time…

dc

Valve has been the best thing going for gaming since 1998 and is still going strong.

James Tolson

Cool, we can all now install our favorite Linux distro and never look back ;-)

Mirimon

hm…. this could, with some work.. make anything play an xb1 game (which would matter only for those games that are truly exclusive.. and since there aren’t enough of those, or that are worth it, putting in that much work isn’t worth the effort…. although…..

Jeremy Garcia

If you’ve ever heard of Wine or Cedega — emulation software for running DirectX games on Linx…

WINE = WINE Is Not an Emulator

WINE is a compatibility layer that translates Windows API calls into POSIX calls on-the-fly, instead of simulating Windows’ logic, according to WineHQ.

Luiz

WINE, wine is not executable, just kidding.

Avatar1337

Why do they not develop in OpenGL in the first place that can be run everywhere and is even faster?

Michal Gloc

It’s not easy to convince studios to switch to OpenGL. Just think how tough it is to convince a corporation to dump Windows and MsOffice, and switch all the computers to Linux and LibreOffice. Only with games it’s even tougher. They have developers with a lot of DirectX experience, and now they would have to retrain them. Then there’s all the dev tools that are made for DX which would need to be changed. And there is a question of reimplementing codebase or starting from scratch for next title. It’s money and time investment and business risk, so they are reluctant to try it.
They need to see that it makes financial sense to switch.

Matthew Smit

You don’t need to retrain them that much. DirectX is an api to access
the graphics card, same as opengl. They are different apis, but all of
the higher level knowledge applies to both of them. All the graphics
techniques are the same, just one in hlsl and one in glsl. All of the
maths equations are the same, all of the rendering techniques are the
same.

Sure, things are slightly different. But any good programmer
is going to pick up another api really quickly, especially if it is
related to stuff they are already doing. There isn’t much difference
between device->DrawUserPrimitives and glDrawPrimitives.

JMF

Sorry, but ToGL it’s not -not originally at least- a development from Valve. The project is 18 years old.

They have no problem of using the name in reality because no trademark is applied only copyright on the work which is clearly different anyway (the one is TK widget the other “Abstraction layer for DirectX to OpenGL translation”)

Guest

Valve is a joke…they need to fall in line or get the hell outta the way.

Skurge

what does the wiiU use? I was just wondering if this would make porting games to that easier. I know UBI have there engine ported to the wiiU and it would be good to have a generic HAL for it.

Teco

Now that i’ve found something that can turn directx into opengl, now I just need to find a way to actually use it! Does anyone have any experience in Github, if so, can they make an installer/ tutorial for people who don’t know how to use it?

Use of this site is governed by our Terms of Use and Privacy Policy. Copyright 1996-2015 Ziff Davis, LLC.PCMag Digital Group All Rights Reserved. ExtremeTech is a registered trademark of Ziff Davis, LLC. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis, LLC. is prohibited.