Valve Open Sources Their DirectX To OpenGL Layer 130
jones_supa writes "A bit surprisingly, Valve Software has uploaded their Direct3D to OpenGL translation layer onto GitHub as open source. It is provided as-is and with no support, under the MIT license allowing you to do pretty much anything with it. Taken directly from the DOTA2 source tree, the translation layer supports limited subset of D3D 9.0c, bytecode-level HLSL to GLSL translator, and some SM3 support. It will require some tinkering to get it to compile, and there is some hardcoded Source-specific stuff included. The project might bring some value to developers who are planning to port their product from Windows to Linux."
On the road to replacing DirectX (Score:5, Insightful)
With a big company (in terms of money) like Valve pushing OpenGL there is a real chance DirectX will face serious and permanent competition. We will finally have a serious alternative to the suffocating model of forcing a new operating system down peoples throat through software. It worked great with the browser, now lets hope Valve can make it happen for games.
Re:Makes sense (Score:5, Insightful)
Re:On the road to replacing DirectX (Score:5, Insightful)
Re:Winelib (Score:3, Insightful)
Could this be of use to the Winelib [winehq.org] project?
(As the name implies, it's the compile-time analogue of Wine.)
Probably not. The wine guys tend to be more or less anti toward anything that they didn't write and thus can assert that it's not infringement on Microsoft's source code. Accepting that much code from Valve sounds very risky for them.
Re:On the road to replacing DirectX (Score:3, Insightful)
In light of the fact that OpenGL's more portable to more platforms, it's not as hard a sell as you'd think. Esp. for more casual games. Want to target iOS and Android? You'll be doing OpenGL ES 2.x. The same game will target PS3, PS4, OSX, Linux, and Steam/SteamBox with only a few modifications.
Re:On the road to replacing DirectX (Score:2, Insightful)
Since OpenGL is the only language to run on mobile, and Mac, and Linux plus it's available on all the consoles it seems kind of crazy to target anything else if your code is expected to survive for any length of time given the decline of the Windows PC market.
Re:question (Score:4, Insightful)
My guess it that they were doing a "two birds with one stone" strategy - using this project as an excuse (and test-case) for the translation layer, hoping that some devs would take this opportunity to port their DX9 games to Linux because of it, thereby improving the value of SteamOS.
Another option is that they didn't write DOTA2 from scratch, but reused an existing engine. Which in turn was based on some previous works, and at some point Direct3D was used, and remained there the whole time.
Re:On the road to replacing DirectX (Score:4, Insightful)
Re:Winelib (Score:5, Insightful)
Probably not. The wine guys tend to be more or less anti toward anything that they didn't write and thus can assert that it's not infringement on Microsoft's source code. Accepting that much code from Valve sounds very risky for them.
Valve isn't some fly-by-night operation. They almost certainly have more exposure to legal liability than the Wine project would.
Re:On the road to replacing DirectX (Score:5, Insightful)
OpenGL is pretty much used everywhere but Microsoft targeted games (Windows and Xbox). Using DirectX on Windows games allowed them to be portable between PC and the Xbox so more and more games went the D3D route to remain portable between the two.
I believe almost all CAD and 3D modelling software are OpenGL based. Android and iOS use OpenGL ES while any non Windows OS such as Linux and OSX use OpenGL for 3D graphics. With the big push to mobile and Microsoft left in the dust, OpenGL is the dominant player.
Re:Winelib (Score:5, Insightful)
Hold on, The subset of DX9.0c is probably the Xbox360 native API: http://en.wikipedia.org/wiki/Comparison_of_OpenGL_and_Direct3D#Gaming [wikipedia.org]
This could be useful for studios looking to port Xbox360 titles to the Steam Box platform. It makes sense as there are a lot of titles that could see a sort of resurrection on Steam and bring in some more money. It is also possibly the same D3D API subset used for Windows Phone 8.
Re:On the road to replacing DirectX (Score:0, Insightful)
They don't offer more functionality, though. DirectX 11 eats OpenCL; XAudio2 eats OpenAL; Collada isn't even an API, it's a file format. Kronos offer more-or-less equivalent functionality to Windows, except there's no common math library, the OpenGL/OpenCL APIs are inherently lower-performance than the Direct3D 11 API, and OpenGL continues to lag behind DirectX 11 on features like surface format aliasing and memory-mapped resources. Also, none of the Kronos APIs handle video mode switching or vsync events or window painting. And if you look at how OGL has evolved over the last 10 years it's obvious they're just copying D3D a generation later. Not once has OGL moved ahead of the curve. Not once. DirectX is and will continue to be the bleeding edge giving the best support for the latest hardware. It's ridiculous to claim the Kronos APIs have more functionality. And with DirectX 12 being announced in a few weeks, Kronos will be busy for a year speccing Open GL 5 to match it.