Search Unity

Why DirectX?

Discussion in 'General Discussion' started by Goldgamer-, Mar 13, 2021.

  1. Goldgamer-

    Goldgamer-

    Joined:
    Jul 18, 2017
    Posts:
    7
    Hey,

    I would like to know why DirectX is the default in unity.
    So what is the advantage for DirectX in Windows.
    Isn’t Vulkan the future?
    And maybe if Vulkan is missing a few features isn’t it better to set Vulkan on Windows as default and only if a developer needs specific features he just could switch afterwards right?
    Vulkan has a lot better compatibility and performance on a lot of devices that’s why I’m asking.
    And it has better Wine support out of the box
     
  2. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Because the DirectX APIs are highly performant and ensure compatibility with a wide range of Windows devices that may not support Vulkan, like older hardware or integrated graphics chips.

    The future doesn't mean jack aside from futureproofing and it's not like DirectX is going away.

    Again, no. Future hardware and even modern low-end hardware is not something that should be taken as guaranteed. Unity has to target a lot of projects and right now the best compatibility for Windows is going to be DirectX.

    The compatibility thing is outright wrong, as covered.

    Make a linux build then.
     
  3. Armynator

    Armynator

    Joined:
    Feb 15, 2013
    Posts:
    67
    Have you ever shipped a game with Unity yet? When I set Vulkan to default with DX11 fallback enabled, it only took a few hours until I received the first complaints. Mostly the fallback wasn't working correctly, but there also have been performance problems, especially with HDRP.
    It's just buggy and not well supported yet. It also (at least for me) crashes the editor on simple things like texture imports sometimes, so I'll stay away from it for now and see no reason why it should become default anytime soon.

    DirectX 11 on the other hand magically runs on anything that has Windows 10 installed. (thanks to the builtin software renderer)
    Also take a look at all the hardware Vulkan will never run on: GTX 500 series or older, Intel HD Graphics 2000-6000, AMD Radeon HD 5000 and 6000 series - still fine for really simple 3D games, or advanced 2D games, and still used in some countries around the world or in older office-hardware. With DX11 or OpenGL your games could work there, with Vulkan they won't for sure.
     
    angrypenguin and Deleted User like this.
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,175
    No. Just as OpenGL failed to surpass early releases of Direct3D, Vulkan will likely never surpass current releases.
     
  5. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    Because it is "defacto" platform default graphic API on windows.
    Nothing prevents you from starting unity in OpenGL mode thought.

    It doesn't work this way.

    Vulkan and directx have slightly different goals, with vulkan also being crosss-platform while DirectX being windows only.

    Normally cross platform graphic API would be OpenGL, but in practice when somebody makes an OpenGL-targeting game, things get interesting (does anyone remember Rage release mess?).

    Given that Unity can compile for a different API, there's not much reason for you to care what you're using.
     
    NotaNaN likes this.
  6. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    DX11 api is not built to scale while Vulkan and DX12 are. Since 6 and 8 core now is mainstream unity should really focus on getting Vulkan/DX12 and gfx jobs stable.
     
    Joe-Censored likes this.
  7. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Sure, but that's no reason to change the default, even after the system is ironed out. If you're targeting a case where that makes more sense it takes all of 10 seconds to change. For everyone else, the current default is a sensible one.

    Huh? To me that's a good reason for things to be how they are.

    Another is that, like it or not, DirectX is the standard provided by and pushed by the platform vendor. Someone called it "de facto" before, but that's not the case. It's as official as it can get.

    I love cross-platform stuff too. But with Unity supporting both out of the box it just makes sense for the 1st party option to be the default - as it is for every other platform.
     
    NotaNaN and Ryiah like this.
  8. Goldgamer-

    Goldgamer-

    Joined:
    Jul 18, 2017
    Posts:
    7
    The problems is a lot of company’s just don’t want to add as example Linux support because it’s to expensive for compiling.
    So Vulkan would lead at perfect rate for Windows and Linux
     
  9. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    DirectX is far more likely to work out of the box than Vulkan on the average user's Windows PC, specially if your target audience is more casual. The more your game crashes and glitches, the more people will refund it.
     
  10. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    You have to remember what is theoretically possible is a very different thing then actual implementations. New api's often require significant changes to take full advantage of that are non trivial to adapt to in existing rendering pipelines. So engines add support non optimally at times. Graphics api's are extremely complex beasts.


    Plus on the PC side Windows is king when it comes to games. Nobody cares about Wine, almost nobody cares about LInux. And quite a few don't care about Apple. Defaulting to something that caters to a minority of your user base at the expensive of the majority would be amazingly dumb.
     
  11. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    Modern engines abstract graphical API away, and change of an OS is done with a press of a button.

    Nope, it wouldn't. We had OpenGL for a long time, that didn't greatly increase number of linux games.

    Main issue with linux is that aside from low adoption rate, it is incredibly fragmented, with large number of different distributions and different ways to install a program.

    By the way, that results in precompiled games quickly breaking. For example, I remember trying to play Soldier Fortune 1 on a more recent system and it ended up not functioning due to mismatch of, I believe glibc. Meanwhile on windows system it is often possible to launch 20 year old programs. Not always, of course, but often.
     
    angrypenguin likes this.
  12. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Maybe its time for Microsoft to be as bold as Apple and throw out that old kernel and begin a new. Alot of the problems with Windows is because of that backward compatibility. Maybe its time to leave x86 behind too
     
  13. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    It also results in difficulty in QA, maintenance and customer service. @Goldgamer- there's a heck of a lot more to supporting a platform than just compiling your thing. Unity already largely takes care of that part for you.
     
  14. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    Linux situation makes me think that if someone is interested in promoting Linux as a gaming platform, they'd need to create some sort of "gaming ecosystem" or "framework" that would provide abstraction layer for necessary functions for gaming only. Like a minimum number of functions that are guaranteed to work as long as the "ecosystem" is supported by the platform.

    For example, coming from windows world a situation where a game can break due to glibc update is simply bizarre. Because even if the game doesn't rely on some "Never changing" dll like msvcrt (that's gonna be insanely rare these days), version differences are handled by WinSxS and manifests.

    Basically there has to be a way to keep proprietary software working long term without recompilation....
     
    Deleted User likes this.
  15. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    In a rare moment, I agree with you. One of the rare few things Apple has done recently that was at all interesting was push out ARM based laptops that have a shockingly performant and compatible (though still in need of work) compatibility layer for x86 software. I've argued for a while that there should be a transition to ARM for desktops thanks to the extreme power consumption to performance ratios and we've even started to see some movement in China producing ARM chips for that very purpose.

    Windows has become a monolith, and while I understand the reasoning I think there must be better solutions than burdening all this on the kernel itself.
     
  16. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Must feel good to be right once in a while (the times when you agree with me). :)

    Yeah I do understand the need for some degree of backward compability but both Intel and Microsoft have taken it too far.
     
  17. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,175
    I wouldn't be surprised if the Windows Subsystems for Linux initiative had that as their long term goal.
     
    MadeFromPolygons likes this.
  18. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    But they managed to create docker images on windows so I think they called it a day :)
    Edit: it was no small feat btw to get windows to run as a docker container

    So you think they would run next windows on Linux kernel? Who knows :)
     
  19. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    The problem with windows is not the kernel, but all the garbage that is bundled with the system. That's something that should be thrown out - 90% of the bundled software.

    Kill off Edge, Cortona, Camera, Feedback Hub, Microsfot Store, One Note, Photos, Skype, Xbox Game Bar and every single piece of garbage that is bundled with the system. Kill off Explorer as well while you're at it, and replace it with a minimum desktop.

    The result will be a lean but powerful system. "Windows Poweruser edition".

    Obviously this thing ain't happening. But we can dream, right?

    That wouldn't be too surprising, as that's what wine does.
     
    Last edited: Mar 15, 2021
    MadeFromPolygons likes this.
  20. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    I guess alot of it is above the kernel, but a kernel with such backward compability certainly has strange exeucton paths and quirks for combability :D

    You got Windows Lean, havent used it though. I'm on Windows Enterprise the Power user edition you talk about and it has even more features :D

    Probably the biggest improvement would be a kernel renewal AND switch out x86
     
  21. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    I'm using Windows 10 Ultimate, which, apparently, has been rebranded as "pro" since. And the only reason I bought it is because it was the only way to acquire language pack I needed, due to idiotic store policies back then.

    I'm not sure why you keep talking about kernel, as windows kernel is pretty much the only part that is doing fine. And speaking of compatibility, compatibility is the part that Linux lacks and would need.
     
  22. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Enterprise is just a little bit more Pro than Pro. :D Only reason I got it was because we got a good MSDN subscription deal from Microsoft.

    Like I said, its a balance. You cant keep combability as long as MS have done and keep a lean and clean kernel.
     
  23. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    Kernel does not need to deal with compatibility. See how Wine works on Linux.
    The kernel has been improved, by the way. The number of BSODs is at all time low.
    However, userspace software has deteriorate and most of it is bloated garbage.
     
  24. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Only way to get a BSOD today is with broken drivers, faulty hardware or faulty hardware configure (memory timings etc)
     
    Joe-Censored likes this.
  25. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    DX11 is the most mature and stable API, both from a Windows and graphics driver standpoint, and a Unity support standpoint. It is a logical default for Windows users. When you choose a default, it should be with maximum stability in mind.
     
    SparrowGS and Ryiah like this.
  26. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Or you can run a program that blocks all the bs windows services from running, I've had one for ages, don't remember what it's called but it works great - you can probably find one fairly easily with a quick search.
     
    Joe-Censored likes this.
  27. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    That's not good enough, because I actually want perfection here.

    I don't want garbage to be blocked. I want it removed, preferably from existence, and I want entire OS use 64 megabytes of RAM to run.

    And THAT is not happening. But we can dream, right? And it was possible before. Long time ago, in a galaxy far away.
     
    Joe-Censored likes this.