Jump to content

  • Log In with Google      Sign In   
  • Create Account

AlanWu

Member Since 03 Dec 2012
Offline Last Active Aug 15 2015 02:09 AM

#5240697 Is OpenGL enough or should I also support DirectX?

Posted by AlanWu on 16 July 2015 - 12:09 AM

Back to the OP - if I was starting a project right now that had to run everywhere, I would make a renderer with two bavk-ends initially: D3D11 using feature level 9_x, and a port of that back-end to the actual D3D9c API (avoiding all the fixed function parts, and sticking to shader model 2).

Why? Because D3D9 runs on Windows from XP onwards, and Linux via Wine. D3D9 can also be zero-effort ported to GL2 by using toGL, which gets you mac and native linux (that's how Valve ported their Source games). D3D11_FL_9 will run really efficiently and be really stable on modern versions of Windows, plus makes for a great developer environment with good tool support. And lastly, shader model 2 shader code will run on every GPU you care about.
The only missing piece ie you'll later have to write your own gl|ES port.

Microsoft constantly obsoletes its own APIs as well, so really it is a poor decision for anyone who is not part of a big company to bother with using it.

You will be able to use vulkan on windows systems, so really there will be no point to DirectX any more

MS releases new D3D versions on roughly the same schedule as new GL versions appear. D3D9~=GL2, D3D10~=GL3, D3D11~=GL4, D3D12~=Vulkan.
All those old APIs still work fine, despite being obsolete/deprecated.

You can already use GL on Windows systems (Vulkan is basically just GL5), so there should already be no point to DirectX any more... Right?

 

Good idea. However, if I use toGL to change my D3D9 codes into OpenGL, will there be a big drop in performance?




#5240695 Is OpenGL enough or should I also support DirectX?

Posted by AlanWu on 16 July 2015 - 12:08 AM

I can tell you my experience:

 

I thought that supporting OpenGL would be enough. It wasn't. But it depends on what you want to aim. Our goal was to keep compatibility with DX10 hardware while still taking advantage of DX11/12 hardware features.

 

There are several reasons GL only approach didn't work for us:

  1. Both NV & AMD stopped shipping drivers for anything below GeForce 400 / Radeon HD 5000. Their OpenGL driver versions are outdated (specially AMD's which cut off driver support 6 months sooner than NV); and if they've got a bug or don't support a specific extension you need (even extensions that would normally work on DX10 hardware); don't hope they will get fixed or added in a later release. In contrast, D3D drivers have been historically been more stable, more thoroughly tested and feature complete. As a result, supporting these cards via D3D is easy.
  2. Intel GL drivers sucked for a very long time, and their definition of "old hardware" is anything they shipped older than 1 year. Technically that's the same problem as NV & AMD just aggravated. But GL drivers have only become decent for Intel HD 4400 and newer (in a driver release that was literally... just a few months ago), some of these cards are DX11 level hardware (not just DX10) and Intel's market share is so large and their deprecation is so strict and narrow that it deserves its own point.
  3. There are so many variables that come into play, that sometimes D3D will get you higher performance, and sometimes OpenGL will get you higher performance. It depends on the driver, GPU involved, API calls you've made, and shader syntax you've used. Supporting both lets your users decide which one runs better for them.

 

Of course this is all about your particular case. If you don't have the resources (time) or don't feel you're experienced enough to support both APIs at the same time; or you only care about bleeding edge hardware and software; then you can focus your efforts into just one API.

Thank you for replying. So apparently drivers is an issue. 




#5235618 Is OpenGL enough or should I also support DirectX?

Posted by AlanWu on 18 June 2015 - 11:49 PM

Thank you guys very much. I now know what I need to do.

I've never used OpenGL and it seems I need to do much more work with it than if I use DirectX. Since I want to support old computers, I might go with OpenGL 2.1. I'll decide that later. smile.png




#5235444 Is OpenGL enough or should I also support DirectX?

Posted by AlanWu on 18 June 2015 - 05:38 AM

On Windows, do you want to support machines that probably never had a GPU driver update installed, and whose users don't even know how to update drivers? If the answer is yes, you pretty much need to default to DirectX on Windows.

Ugh... those users are a nightmare by themselves. I wouldn't want them as customers. Even if they pay you (chances are they don't, otherwise they'd not have a computer that they pulled out of the trash can), they cannot possibly pay you enough for the support cost they will cause.
True. My customers have to know how to follow instructions at least.
It seems OpenGL 2.1 is really bad and can potentially cause a lot of problems?


PARTNERS