• 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

btarunr

Editor & Senior Moderator
Staff member
Joined
Oct 9, 2007
Messages
47,294 (7.53/day)
Location
Hyderabad, India
System Name RBMK-1000
Processor AMD Ryzen 7 5700G
Motherboard ASUS ROG Strix B450-E Gaming
Cooling DeepCool Gammax L240 V2
Memory 2x 8GB G.Skill Sniper X
Video Card(s) Palit GeForce RTX 2080 SUPER GameRock
Storage Western Digital Black NVMe 512GB
Display(s) BenQ 1440p 60 Hz 27-inch
Case Corsair Carbide 100R
Audio Device(s) ASUS SupremeFX S1220A
Power Supply Cooler Master MWE Gold 650W
Mouse ASUS ROG Strix Impact
Keyboard Gamdias Hermes E2
Software Windows 11 Pro
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.



View at TechPowerUp Main Site
 
Joined
Mar 15, 2013
Messages
3,675 (0.86/day)
Location
GMT +2
System Name Red Radiance l under construction
Processor 5800x
Motherboard x470 taichi
Cooling stock wrath
Memory TridentZ Neo rgb 3600mhz (2x8 kit)
Video Card(s) Sapphire Vega 64 nitro+
Storage 970 evo nvme
Display(s) lc27g75tq
Case tt core x5 tge
Audio Device(s) sennheiser's pc323d usb soundcard
Power Supply corsair AX860i
Mouse roccat burst pro
Keyboard roccat ryos mk fx
Software windows 10
linux gaming on horizont
 
Joined
Sep 6, 2013
Messages
3,391 (0.82/day)
Location
Athens, Greece
System Name 3 desktop systems: Gaming / Internet / HTPC
Processor Ryzen 5 7600 / Ryzen 5 4600G / Ryzen 5 5500
Motherboard X670E Gaming Plus WiFi / MSI X470 Gaming Plus Max (1) / MSI X470 Gaming Plus Max (2)
Cooling Aigo ICE 400SE / Segotep T4 / Νoctua U12S
Memory Kingston FURY Beast 32GB DDR5 6000 / 16GB JUHOR / 32GB G.Skill RIPJAWS 3600 + Aegis 3200
Video Card(s) ASRock RX 6600 + GT 710 (PhysX) / Vega 7 integrated / Radeon RX 580
Storage NVMes, ONLY NVMes / NVMes, SATA Storage / NVMe, SATA, external storage
Display(s) Philips 43PUS8857/12 UHD TV (120Hz, HDR, FreeSync Premium) / 19'' HP monitor + BlitzWolf BW-V5
Case Sharkoon Rebel 12 / CoolerMaster Elite 361 / Xigmatek Midguard
Audio Device(s) onboard
Power Supply Chieftec 850W / Silver Power 400W / Sharkoon 650W
Mouse CoolerMaster Devastator III Plus / CoolerMaster Devastator / Logitech
Keyboard CoolerMaster Devastator III Plus / CoolerMaster Devastator / Logitech
Software Windows 10 / Windows 10&Windows 11 / Windows 10
This looks like the opossite to Scitech GLdirect that was translating OpenGL to DirectX in Windows.
 
Joined
Feb 8, 2012
Messages
3,014 (0.64/day)
Location
Zagreb, Croatia
System Name Windows 10 64-bit Core i7 6700
Processor Intel Core i7 6700
Motherboard Asus Z170M-PLUS
Cooling Corsair AIO
Memory 2 x 8 GB Kingston DDR4 2666
Video Card(s) Gigabyte NVIDIA GeForce GTX 1060 6GB
Storage Western Digital Caviar Blue 1 TB, Seagate Baracuda 1 TB
Display(s) Dell P2414H
Case Corsair Carbide Air 540
Audio Device(s) Realtek HD Audio
Power Supply Corsair TX v2 650W
Mouse Steelseries Sensei
Keyboard CM Storm Quickfire Pro, Cherry MX Reds
Software MS Windows 10 Pro 64-bit
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
 

Easy Rhino

Linux Advocate
Staff member
Joined
Nov 13, 2006
Messages
15,598 (2.36/day)
Location
Mid-Atlantic
System Name Desktop
Processor i5 13600KF
Motherboard AsRock B760M Steel Legend Wifi
Cooling Noctua NH-U9S
Memory 4x 16 Gb Gskill S5 DDR5 @6000
Video Card(s) Gigabyte Gaming OC 6750 XT 12GB
Storage WD_BLACK 4TB SN850x
Display(s) Gigabye M32U
Case Corsair Carbide 400C
Audio Device(s) On Board
Power Supply EVGA Supernova 650 P2
Mouse MX Master 3s
Keyboard Logitech G915 Wireless Clicky
Software The Matrix
with this and the crytek engine available on linux it looks like easy rhino was right 5 years ago. please bow down.
 
Joined
Mar 15, 2013
Messages
3,675 (0.86/day)
Location
GMT +2
System Name Red Radiance l under construction
Processor 5800x
Motherboard x470 taichi
Cooling stock wrath
Memory TridentZ Neo rgb 3600mhz (2x8 kit)
Video Card(s) Sapphire Vega 64 nitro+
Storage 970 evo nvme
Display(s) lc27g75tq
Case tt core x5 tge
Audio Device(s) sennheiser's pc323d usb soundcard
Power Supply corsair AX860i
Mouse roccat burst pro
Keyboard roccat ryos mk fx
Software windows 10
valve is working to make soruce 2 linux capable and then port all source 2 based games to linux
 
Joined
Aug 11, 2011
Messages
4,357 (0.89/day)
Location
Mexico
System Name Dell-y Driver
Processor Core i5-10400
Motherboard Asrock H410M-HVS
Cooling Intel 95w stock cooler
Memory 2x8 A-DATA 2999Mhz DDR4
Video Card(s) UHD 630
Storage 1TB WD Green M.2 - 4TB Seagate Barracuda
Display(s) Asus PA248 1920x1200 IPS
Case Dell Vostro 270S case
Audio Device(s) Onboard
Power Supply Dell 220w
Software Windows 10 64bit
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.
 

sneekypeet

not-so supermod
Staff member
Joined
Apr 12, 2006
Messages
29,627 (4.34/day)
System Name EVA-01
Processor Intel i7 13700K
Motherboard Asus ROG Maximus Z690 HERO EVA Edition
Cooling ASUS ROG Ryujin III 360 with Noctua Industrial Fans
Memory PAtriot Viper Elite RGB 96GB @ 6000MHz.
Video Card(s) Asus ROG Strix GeForce RTX 3090 24GB OC EVA Edition
Storage Addlink S95 M.2 PCIe GEN 4x4 2TB
Display(s) Asus ROG SWIFT OLED PG42UQ
Case Thermaltake Core P3 TG
Audio Device(s) Realtek on board > Sony Receiver > Cerwin Vegas
Power Supply be quiet DARK POWER PRO 12 1500W
Mouse ROG STRIX Impact Electro Punk
Keyboard ROG STRIX Scope TKL Electro Punk
Software Windows 11
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!
 

Tatty_Two

Gone Fishing
Joined
Jan 18, 2006
Messages
25,944 (3.75/day)
Location
Worcestershire, UK
Processor Intel Core i9 11900KF @ -.080mV PL max @220w
Motherboard MSI MAG Z490 TOMAHAWK
Cooling DeepCool LS520SE Liquid + 3 Phanteks 140mm case fans
Memory 32GB (4 x 8GB SR) Patriot Viper Steel Bdie @ 3600Mhz CL14 1.45v Gear 1
Video Card(s) Asus Dual RTX 4070 OC + 8% PL
Storage WD Blue SN550 1TB M.2 NVME//Crucial MX500 500GB SSD (OS)
Display(s) AOC Q2781PQ 27 inch Ultra Slim 2560 x 1440 IPS
Case Phanteks Enthoo Pro M Windowed - Gunmetal
Audio Device(s) Onboard Realtek ALC1200/SPDIF to Sony AVR @ 5.1
Power Supply Seasonic CORE GM650w Gold Semi modular
Software Win 11 Home x64
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.
 
Joined
Feb 17, 2010
Messages
1,674 (0.31/day)
Location
Azalea City
System Name Main
Processor Ryzen 5950x
Motherboard B550 PG Velocita
Cooling Water
Memory Ballistix
Video Card(s) RX 6900XT
Storage T-FORCE CARDEA A440 PRO
Display(s) MAG401QR
Case QUBE 500
Audio Device(s) Logitech Z623
Power Supply LEADEX V 1KW
Mouse Cooler Master MM710
Keyboard Huntsman Elite
Software 11 Pro
Benchmark Scores https://hwbot.org/user/damric/
Does this add even more CPU overhead?
 

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
13,171 (2.80/day)
Location
Concord, NH, USA
System Name Apollo
Processor Intel Core i9 9880H
Motherboard Some proprietary Apple thing.
Memory 64GB DDR4-2667
Video Card(s) AMD Radeon Pro 5600M, 8GB HBM2
Storage 1TB Apple NVMe, 4TB External
Display(s) Laptop @ 3072x1920 + 2x LG 5k Ultrafine TB3 displays
Case MacBook Pro (16", 2019)
Audio Device(s) AirPods Pro, Sennheiser HD 380s w/ FIIO Alpen 2, or Logitech 2.1 Speakers
Power Supply 96w Power Adapter
Mouse Logitech MX Master 3
Keyboard Logitech G915, GL Clicky
Software MacOS 12.1
Does this add even more CPU overhead?
Any compatibility layer is going to add some level of overhead. I'm curious if it's going to perform well.
 
Joined
Aug 11, 2011
Messages
4,357 (0.89/day)
Location
Mexico
System Name Dell-y Driver
Processor Core i5-10400
Motherboard Asrock H410M-HVS
Cooling Intel 95w stock cooler
Memory 2x8 A-DATA 2999Mhz DDR4
Video Card(s) UHD 630
Storage 1TB WD Green M.2 - 4TB Seagate Barracuda
Display(s) Asus PA248 1920x1200 IPS
Case Dell Vostro 270S case
Audio Device(s) Onboard
Power Supply Dell 220w
Software Windows 10 64bit
Any compatibility layer is going to add some level of overhead. I'm curious if it's going to perform well.

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.
 
Joined
Dec 28, 2012
Messages
3,949 (0.90/day)
System Name Skunkworks 3.0
Processor 5800x3d
Motherboard x570 unify
Cooling Noctua NH-U12A
Memory 32GB 3600 mhz
Video Card(s) asrock 6800xt challenger D
Storage Sabarent rocket 4.0 2TB, MX 500 2TB
Display(s) Asus 1440p144 27"
Case Old arse cooler master 932
Power Supply Corsair 1200w platinum
Mouse *squeak*
Keyboard Some old office thing
Software Manjaro
Does this add even more CPU overhead?

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.
 
Joined
Aug 22, 2007
Messages
3,592 (0.57/day)
Location
Terra
System Name :)
Processor Intel 13700k
Motherboard Gigabyte z790 UD AC
Cooling Noctua NH-D15
Memory 64GB GSKILL DDR5
Video Card(s) Gigabyte RTX 4090 Gaming OC
Storage 960GB Optane 905P U.2 SSD + 4TB PCIe4 U.2 SSD
Display(s) Alienware AW3423DW 175Hz QD-OLED + AOC Agon Pro AG276QZD2 240Hz QD-OLED
Case Fractal Design Torrent
Audio Device(s) MOTU M4 - JBL 305P MKII w/2x JL Audio 10 Sealed --- X-Fi Titanium HD - Presonus Eris E5 - JBL 4412
Power Supply Silverstone 1000W
Mouse Roccat Kain 122 AIMO
Keyboard KBD67 Lite / Mammoth75
VR HMD Reverb G2 V2
Software Win 11 Pro
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.

7 year old??
 
Joined
Oct 29, 2009
Messages
2,670 (0.48/day)
System Name Old Gateway
Processor i5 4440 3.1ghz
Motherboard Gateway
Cooling Eh it doesn't thermal throttle
Memory 2x 8GB JEDEC 1600mhz DDR3
Video Card(s) RX 560D 4GB
Storage 240gb 2.5 SSD 3TB 7.2k Seagate
Display(s) Dell @ 1280*1024 75hz
Case Gateway
Audio Device(s) Gateway Diamond Audio EMC2.0-USB 5375U ($15 a long ass time ago)
Power Supply 380w oem
Mouse Purple Walmart special, 1600dpi. Black desk mat
Keyboard SteelSeries Apex 100
VR HMD Lmao
Software Windows 10
Benchmark Scores It can run Crysis (Original), Doom 2016, and Halo MCC
yep... they're getting that old now. though 6 yrs not 7.
 
Joined
Dec 28, 2012
Messages
3,949 (0.90/day)
System Name Skunkworks 3.0
Processor 5800x3d
Motherboard x570 unify
Cooling Noctua NH-U12A
Memory 32GB 3600 mhz
Video Card(s) asrock 6800xt challenger D
Storage Sabarent rocket 4.0 2TB, MX 500 2TB
Display(s) Asus 1440p144 27"
Case Old arse cooler master 932
Power Supply Corsair 1200w platinum
Mouse *squeak*
Keyboard Some old office thing
Software Manjaro
yep... they're getting that old now. though 6 yrs not 7.
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.
 
Joined
Oct 2, 2004
Messages
13,791 (1.87/day)
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?
 

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
13,171 (2.80/day)
Location
Concord, NH, USA
System Name Apollo
Processor Intel Core i9 9880H
Motherboard Some proprietary Apple thing.
Memory 64GB DDR4-2667
Video Card(s) AMD Radeon Pro 5600M, 8GB HBM2
Storage 1TB Apple NVMe, 4TB External
Display(s) Laptop @ 3072x1920 + 2x LG 5k Ultrafine TB3 displays
Case MacBook Pro (16", 2019)
Audio Device(s) AirPods Pro, Sennheiser HD 380s w/ FIIO Alpen 2, or Logitech 2.1 Speakers
Power Supply 96w Power Adapter
Mouse Logitech MX Master 3
Keyboard Logitech G915, GL Clicky
Software MacOS 12.1
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?

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
 

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
13,171 (2.80/day)
Location
Concord, NH, USA
System Name Apollo
Processor Intel Core i9 9880H
Motherboard Some proprietary Apple thing.
Memory 64GB DDR4-2667
Video Card(s) AMD Radeon Pro 5600M, 8GB HBM2
Storage 1TB Apple NVMe, 4TB External
Display(s) Laptop @ 3072x1920 + 2x LG 5k Ultrafine TB3 displays
Case MacBook Pro (16", 2019)
Audio Device(s) AirPods Pro, Sennheiser HD 380s w/ FIIO Alpen 2, or Logitech 2.1 Speakers
Power Supply 96w Power Adapter
Mouse Logitech MX Master 3
Keyboard Logitech G915, GL Clicky
Software MacOS 12.1
Sure, Direct3D also had "minimal" overhead which now turned into a massive one...
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.
 
Joined
May 11, 2006
Messages
144 (0.02/day)
System Name HTPC
Processor Ryzen 3600
Motherboard ASRock X570M Pro4
Cooling Aquacomputer Cuplex Kryros Delrin + Aquaduct 720XT
Memory Mushkin Ridgeback DDR4-3200
Video Card(s) Gigabyte Waterforce WB RTX 2080Ti
Storage Crucial M1 500GB
Display(s) Philips 55POS9002/12 OLED TV
Case Silverstone Sugo SG11
Audio Device(s) FiiO D03k -> Pioneer A676 -> KEF iQ7
Power Supply Seasonic G550 PCGH Edition
Mouse MX Master
Keyboard Corsair K63 wireless Lapboard
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

Resident Wat-man
Joined
Jan 28, 2012
Messages
13,171 (2.80/day)
Location
Concord, NH, USA
System Name Apollo
Processor Intel Core i9 9880H
Motherboard Some proprietary Apple thing.
Memory 64GB DDR4-2667
Video Card(s) AMD Radeon Pro 5600M, 8GB HBM2
Storage 1TB Apple NVMe, 4TB External
Display(s) Laptop @ 3072x1920 + 2x LG 5k Ultrafine TB3 displays
Case MacBook Pro (16", 2019)
Audio Device(s) AirPods Pro, Sennheiser HD 380s w/ FIIO Alpen 2, or Logitech 2.1 Speakers
Power Supply 96w Power Adapter
Mouse Logitech MX Master 3
Keyboard Logitech G915, GL Clicky
Software MacOS 12.1
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.
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.
 
Joined
May 11, 2006
Messages
144 (0.02/day)
System Name HTPC
Processor Ryzen 3600
Motherboard ASRock X570M Pro4
Cooling Aquacomputer Cuplex Kryros Delrin + Aquaduct 720XT
Memory Mushkin Ridgeback DDR4-3200
Video Card(s) Gigabyte Waterforce WB RTX 2080Ti
Storage Crucial M1 500GB
Display(s) Philips 55POS9002/12 OLED TV
Case Silverstone Sugo SG11
Audio Device(s) FiiO D03k -> Pioneer A676 -> KEF iQ7
Power Supply Seasonic G550 PCGH Edition
Mouse MX Master
Keyboard Corsair K63 wireless Lapboard
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.
 
Top