Vulkan or D3D12?

Started by
7 comments, last by chaoticbob 7 years, 2 months ago

Is there any clear advantage with either of these?

Are vulkan drivers reliable on windows for all of AMD/Nvidia/Intel(ie not like OpenGL last time I used it)?

Advertisement

I have a D3D11 game that is showing pretty high CPU usage in the AMD driver(about 10-15% CPU time or 4 core/HT system), the driver will also occasionally stall, although AMD has improved this significantly in the latest drivers.

I'm thinking of adding support for one of these API's, I don't think I would want to implement both of them..

It's not clear to me if you want to add support for these APIs for their own sake, or because you think it will magically fix your "high CPU usage." The former seems realistic. The latter is unlikely to actually happen unless you already know precisely what you're doing with D3D11 to cause the high usage (and if you did I'd presume you could just fix that) and know enough about Vulkan or D3D12 to know you can avoid it (which I gather you don't since you're asking this question in the first place). Both these newer APIs give you far, far more control over what's going on. Which is great, but it also means if you don't know what you're doing you can do far, far worse damage to the perf of your code.

Is there any clear advantage with either of these?

This probably comes down to what platforms you want to end up supporting. If you care at all about non-Windows, Vulkan is probably what you want. If you don't, you may as well stick with D3D12, but either are reasonable choices at that point. What are your platform requirements?

D3D12 has the advantage that you won't have to rewrite your D3D11 shaders as GLSL.

(has anyone made a HLSL->SPIR-V transpiler yet?)

Intels Windows Vulkan driver is still beta and developers only - they should make a bold statement about what they have in mind...

Other than that drivers are good enough for Doom :)

People say differences are very small, but Vulkan is open for extensions - already on par with SM 6.0, NV even beyond (Shuffle instruction over all registers, GPU generated command buffers)

(has anyone made a HLSL->SPIR-V transpiler yet?)

It's in official Khronos SPIR-V compiler, but i guess still not finished.

I would say D3D12's biggest advantages are...

  • Better OS integration with Windows (full access to DXGI layer, virtual addresses everywhere, residency control)
  • Shaders are easier to port from D3D11 due to native HLSL compiler. There's a HLSL->SPIR-V compiler in the works and it mostly works, but it's not quite ready for prime-time yet (for example, no support for structured buffers yet)
  • ExecuteIndirect (still no support for this in Vulkan, but I would assume it will be there at some point)
  • It was first out of the gate, and the drivers have had more time to mature. Not sure if that's resulted in anything tangible, outside of Intel not having Vulkan drivers.
  • It works on Xbox 1

As for Vulkan...

  • It runs on Win7 and Win8, along with a few other platforms
  • SPIR-V is a nice shader IL, and current tools are built around LLVM which is pretty cool (MS is coming out with an LLVM-based replacement for DX shaders, but it's still MIA)
  • Full spec is available, which is nice for looking up exact behavior for things that aren't in the documentation
  • Supports extensions for using the latest GPU features
  • Open source shader compiler, shader tools, and validation layer (MS has stated their new shader compiler will be open source, but again it has yet to materialize)

EDIT: I should point out that I haven't personally used Vulkan yet, so there may be other differences that I'm not aware of yet.

There is a GameDev post that talks about its similarities.

And Reddit has another thread about its differences

The reason I use D3D12 instead of Vulkan, ist because - driver support, especially on Intel, is way better on D3D12 - runs better on older Nvidia hardware (maybe also a driver issue) - HLSL shader just work - I could port to UWP and run on XBox potentially (they support only D3D11 currently)
  • SPIR-V is a nice shader IL, and current tools are built around LLVM which is pretty cool (MS is coming out with an LLVM-based replacement for DX shaders, but it's still MIA)

This might be of interest: https://blogs.msdn.microsoft.com/directx/2017/01/23/new-directx-shader-compiler-based-on-clangllvm-now-available-as-open-source/

I wrote this a couple of weeks ago:

https://github.com/chaoticbob/tinyrenderers

It doesn't spell out the advantages of one over the other. It shows how similar and different they are at some fundamental things.

This topic is closed to new replies.

Advertisement