1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Valve Runs a Direct3D to OpenGL Translation Layer

Discussion in 'News' started by btarunr, Mar 13, 2014.

  1. btarunr

    btarunr Editor & Senior Moderator Staff Member

    Joined:
    Oct 9, 2007
    Messages:
    28,705 (11.16/day)
    Thanks Received:
    13,668
    Location:
    Hyderabad, India
    Digging through the source code tree of Dota 2, developers discovered Valve's latest creation, ToGL. Simply put, it's a Direct3D to OpenGL translation layer, which works to reduce duplication of effort in developing games for multiple platforms (such as Windows, Linux, and OS X). The software can translate Direct3D calls to their OpenGL analogues. So far, it can translate only certain kinds of calls within the Direct3D 9.0c API, which should fit Valve's needs adequately. It features a bytecode-level HLSL to GLSL shader language translator. It features only a limited shader model 3.0 support. ToGL is currently being provided by Valve as-is on GitHub, and is unsupported. Developers are free to incorporate it into their projects, and make modifications to it.

    [​IMG]

    Source: GitHub
     
  2. ne6togadno

    ne6togadno

    Joined:
    Mar 15, 2013
    Messages:
    1,358 (2.31/day)
    Thanks Received:
    599
    Location:
    GMT +2
    linux gaming on horizont
     
    Easy Rhino says thanks.
  3. john_

    john_

    Joined:
    Sep 6, 2013
    Messages:
    243 (0.59/day)
    Thanks Received:
    59
    Location:
    Athens, Greece
    This looks like the opossite to Scitech GLdirect that was translating OpenGL to DirectX in Windows.
     
  4. BiggieShady

    BiggieShady

    Joined:
    Feb 8, 2012
    Messages:
    1,008 (1.02/day)
    Thanks Received:
    346
    Location:
    Zagreb, Croatia
    I suppose this is specifically for dota2 linux port .... wonder if it could be used to port all those games that are already xbox 360 ports :laugh: wonder how a bad port of a bad port would be like
     
  5. Easy Rhino

    Easy Rhino Linux Advocate

    Joined:
    Nov 13, 2006
    Messages:
    13,460 (4.64/day)
    Thanks Received:
    3,264
    with this and the crytek engine available on linux it looks like easy rhino was right 5 years ago. please bow down.
     
  6. ne6togadno

    ne6togadno

    Joined:
    Mar 15, 2013
    Messages:
    1,358 (2.31/day)
    Thanks Received:
    599
    Location:
    GMT +2
    valve is working to make soruce 2 linux capable and then port all source 2 based games to linux
     
  7. TRWOV

    TRWOV

    Joined:
    Aug 11, 2011
    Messages:
    3,557 (3.04/day)
    Thanks Received:
    2,126
    Location:
    Mexico
    I don't know if this will affect much. Cedega is more mature, has been around since like forever and I can only think of one game that has used it.
     
    Crunching for Team TPU
  8. sneekypeet

    sneekypeet Unpaid Babysitter Staff Member

    Joined:
    Apr 12, 2006
    Messages:
    21,619 (6.94/day)
    Thanks Received:
    6,141
    How about we all stop calling each other trolls or whatever name it is at the time and move on!
    This is a polite warning to everyone, move along, nothing to see here!
     
  9. Tatty_One

    Tatty_One Senior Moderator Staff Member

    Joined:
    Jan 18, 2006
    Messages:
    16,740 (5.23/day)
    Thanks Received:
    2,539
    Location:
    Worcestershire, UK
    I never cease to be surprised that so much ignorance can fall upon one thread like flys around s**t, a warning was issued a while back, it has been ignored, so sadly pain is a coming, any more crap in here and we wont be talking modest 45 day holidays....... Thank You.
     
    Aquinus, FX-GMC and sneekypeet say thanks.
  10. damric

    damric

    Joined:
    Feb 17, 2010
    Messages:
    374 (0.22/day)
    Thanks Received:
    96
    Does this add even more CPU overhead?
     
  11. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,460 (6.47/day)
    Thanks Received:
    2,188
    Location:
    Concord, NH
    Any compatibility layer is going to add some level of overhead. I'm curious if it's going to perform well.
     
  12. TRWOV

    TRWOV

    Joined:
    Aug 11, 2011
    Messages:
    3,557 (3.04/day)
    Thanks Received:
    2,126
    Location:
    Mexico
    Cedega 6.0 was reporting >90% native speed on some titles (Enemy Territory, WoW, etc.) but that was 4 years ago, not to mention that these translators support up to DX9c.
     
    Crunching for Team TPU
  13. TheinsanegamerN

    Joined:
    Dec 28, 2012
    Messages:
    228 (0.34/day)
    Thanks Received:
    21
    in this day of 7 year old core i7 cpus being capable of running modern games at 60fps, I doubt that the cpu overhead of a program like this would really make any kind of sizable impact on any halfway modern gaming system.
     
  14. Scrizz

    Scrizz

    Joined:
    Aug 22, 2007
    Messages:
    2,949 (1.13/day)
    Thanks Received:
    408
    Location:
    Florida, US
    7 year old??
     
  15. xBruce88x

    xBruce88x

    Joined:
    Oct 29, 2009
    Messages:
    2,420 (1.33/day)
    Thanks Received:
    584
    yep... they're getting that old now. though 6 yrs not 7.
     
    Easy Rhino says thanks.
    More than 25k PPD
  16. TheinsanegamerN

    Joined:
    Dec 28, 2012
    Messages:
    228 (0.34/day)
    Thanks Received:
    21
    well..guess I should leave the counting to the i7 as well. It's amazing how long those things have been around and they still can run just about anything.
     
  17. RejZoR

    RejZoR

    Joined:
    Oct 2, 2004
    Messages:
    4,738 (1.29/day)
    Thanks Received:
    977
    Location:
    Europe/Slovenia
    This is so going in the wrong direction. Instead of using direct HW acceleration through metal API's, they are now doing rendering through several extra layers of API's. How stupid is that, all with excuse they don't have to make double work. That's how console ports are born and i don't have to say it twice, they are all rubbish. I miss the days when games had engines designed from ground up to run on both Direct3D and OpenGL from day one. Remember all the Unreal Engine based games from 1999-2003 or so?
     
  18. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,460 (6.47/day)
    Thanks Received:
    2,188
    Location:
    Concord, NH
    I disagree, if they can get close with minimal overhead, that save a lot of programming hours porting an engine from one 3D API to another. While it might be slower, it's a step in the right direction. It also create a framework for how to port DX applications to OpenGL since there is a library that does the translation for you.

    The real question we have to ask (before we start bashing it,) is what kind of performance will we see out of this compatibility layer. Until our questions are answered we shouldn't judge it. Additionally, it's a lot more than double work to port a game from one API to another. Consider for a moment how many bugs and incompatibilities you come across between the two APIs then remember that they need to thoroughly test it once they even get it working.

    This makes sense for games that were coded for DX and only DX to run in OpenGL. I don't see the problem with that. It's giving you an option where you wouldn't otherwise have one.

    Don't like it? Make your own damn 3d engine. :p
     
    MxPhenom 216 says thanks.
  19. RejZoR

    RejZoR

    Joined:
    Oct 2, 2004
    Messages:
    4,738 (1.29/day)
    Thanks Received:
    977
    Location:
    Europe/Slovenia
    Sure, Direct3D also had "minimal" overhead which now turned into a massive one...
     
  20. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,460 (6.47/day)
    Thanks Received:
    2,188
    Location:
    Concord, NH
    Please start citing your sources if you're going to make claims like that. DX interfaces with hardware-level APIs so overhead will be minimal anyways in most cases, so I'm reluctant to believe that. Any API call is going to have some overhead and take some time to call it, but taking time to call an API doesn't mean that it has a lot of overhead. Some API calls are just simply costly.
     
    eidairaman1 says thanks.
  21. olstyle

    olstyle

    Joined:
    May 11, 2006
    Messages:
    69 (0.02/day)
    Thanks Received:
    11
    As far as I understand from a short look in the source, this wrapper is used at compile-time.
    This means that there is no overhead for redirected calls at runtime, but you need the source of a game to make use of it.
    I'd still expect a slight performance hit compared to native OGl though. Some API-calls are normally avoided/used less in OGl due to bad performance and others from DX which are normally eluded with some effort would perform well when their OGl counterpart is used.
     
    Aquinus says thanks.
  22. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,460 (6.47/day)
    Thanks Received:
    2,188
    Location:
    Concord, NH
    I saw translated calls and not a whole lot of pre-prossessor directives. I don't think it's done at compile time, but it doesn't do much more than add another reference frame to the call stack as most of those translated calls are pretty simple (direct one-to-one translations with one line of code,), but any extra calls take time to do and I'm sure there are things that DX does faster than OpenGL and things that OpenGL does faster than DX.
     
  23. olstyle

    olstyle

    Joined:
    May 11, 2006
    Messages:
    69 (0.02/day)
    Thanks Received:
    11
    Even a stupid compiler will inline most of those calls and get rid of the added reference, but they are not strictly preprocessor, that's right.
     

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page