New to Direct3D programming: 11 vs 12

时光怂恿深爱的人放手 提交于 2020-01-21 03:20:27

问题


For a newbie in D3D programming, should one just learn D3D12 directly or is D3D11 necessary before diving into D3D12?

Assuming starting from scratch and decent knowledge of C++, which way should I go?


回答1:


I've answered this question before so you should take a look at that post.

In short, Direct3D 12 should be thought of as "DirectX Extreme Pro". It assumes you are already an expert in how the Direct3D 11 runtime works to the point that you can basically write it yourself. It is designed to allow middleware engines and low-level graphics developers to have maximum control over the behavior of the GPU. Direct3D 11 is also a "low-level" graphics API, but DirectX 12 has such a thin abstraction that many complexities of modern GPUs are exposed directly to the application programmer; complexities that Direct3D 11 hides from you.

Direct3D 12 is very powerful, but to achieve a very low CPU overhead, the API and runtime do very little to help you out. This exposes the memory model of the driver and makes the GPU/CPU synchronization a manual process that's a bit akin to 'lock-free programming' on the CPU.

If you are entirely new to Direct3D, I strongly suggest you start with DirectX Tool Kit and its tutorials using Direct3D 11. Once you've mastered that, you should be in a good place to move to Direct3D 12 when it makes sense for your applications.

There's a ton of tutorials, samples, books, and other educational material on Direct3D 11. The Direct3D 12 material is a bit thin, mainly consisting of the content on the DirectX-Graphics-Samples GitHub repo. I'm currently working on adding DirectX 12 support to DirectX Tool Kit, but even when it is available you'll find that starting with Driect3D 11 is a lot easier than trying to jump feet-first into DirectX 12.

The other thing to keep in mind w.r.t. to DirectX 12: It is supported only on Windows 10 systems with DirectX 12 enabled video drivers. This includes most Direct3D Feature Level 11.0+ hardware including NVIDIA Fermi, Kepler, Maxwell; AMD GCN; and Intel's Haswell, Broadwell, and Skylake. This, however, does not include any older video cards. See DirectX 12: A Major Stride for Gaming, AMD DirectX 12 Technology, and DirectX Developer Blog

UPDATE: DirectX Tool Kit for DirectX 12 is now available including basic tutorials. You should focus on learning Direct3D 11 before tackling Direct3D 12. DirectX 12 is an API designed for graphics experts and is quite unforgiving to newbies. DirectX Tool Kit helps soften the edges a little, but not much. Generally speaking, unless you are hitting the CPU performance limits of Direct3D 11 there's no need to use Direct3D 12. That said, for graphics experts it's worth learning to have a better understanding of how the underlying GPU hardware works, or those wanting to push the hardware to the limits of performance.

UPDATE 2: I should mention that based on some recent experience, if you mainly use the functionality provided in the DirectX Tool Kit (sprites, spritefont, basic primitives and models, etc.), switching from the DirectX 11 to DirectX 12 version is fairly straight-forward. Also, if you want to use DirectX Raytracing, DirectML, or Shader Model 6, you need to use DirectX 12 instead of DirectX 11. Of course, most game developers actually use existing 3rd party engines like Unity or Unreal Engine which abstract the API so it's more an issue of your target platform instead of usability for those cases.



来源:https://stackoverflow.com/questions/33986737/new-to-direct3d-programming-11-vs-12

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!