Reputation: 61
I'm reading "Practical rendering with DirectX 11" and want to write a simple engine after deep understanding of DirectX concepts.
But today we have DirectX 12 which solves problem as driver overhead (because we closer to hardware) and I'm thinking about using 12 as my primary renderer. But will my engine be some sort of driver overhead at the end of development? I think that driver developers are much smarter then me, so I can just make 12 rendering slower then 11. Right?
Upvotes: 1
Views: 647
Reputation: 41067
DirectX 11 and DirectX 12 solve the same problem but in different ways. They both drive the same hardware and have access to the same hardware features. The difference is in how the CPU and memory are managed.
With DirectX 11, the API is "low-level" but the DirectX Runtime manages the video memory, coordinates resource upload/download, handles buffer renaming, and ensures proper synchronization between the GPU and the CPU.
With DirectX 12, the DirectX Runtime does very little and the application is responsible for everything the DirectX 11 Runtime would handle for you. This is very powerful for allowing applications much more control over how the hardware is driven, but it means that the onus is on the programmer to get everything right even under unusual scenarios and across a wide range of hardware.
Graphics programming and debugging is already a challenge, and using DirectX 12 complicates it immensely with timing problems (akin to the kinds of risks you can have doing multi-threaded lockfree programming), more vendor-specific behavior which requires more test validation, resource management problems that can happen over multiple frames, and more responsibility for how all your programmable shaders manage information sharing with the PCU.
If you are new to graphics programming with DirectX, then I strongly recommend you use DirectX 11. Even if it makes sense for you to eventually use DirectX 12, the API design and documentation assumes you are already an expert in DirectX 11 programming and HLSL. Once you are an expert in DirectX 11, then it still may not make sense to use DirectX 12 for your particular project unless you are finding that the CPU overhead of the DirectX 11 API really is a bottleneck. For someone mainly interested in learning the technology, then it is well worth learning both but you should have a firm grasp on DirectX 11 first.
It's also important to note that DirectX 11 and DirectX 12 have different system requirements. DirectX 11 is supported on Windows 7, Windows 8.1, and Windows 10 and requires WDDM 1.x drivers which are widely available for video hardware ranging from Direct3D hardware feature level 9.1 to 11.1. DirectX 12 is supported on Windows 10 (including Xbox One) and requires WDDM 2.0 drivers which are not available for all video hardware. WDDM 2.0 drivers are widely available for most Direct3D Feature Level 11.0 or later hardware which is most of the GPUs in the market for "core PC gamers", but not for the bulk of video cards used in business settings or older PC gaming systems.
Right now the 'sweet spot' for using DirectX 12 is if you are writing a game and have a good-sized experienced team of graphics developers; are targeting console, 'core' PC gamers, and/or the Universal Windows Platform (UWP) for desktop; and are expecting the game to be CPU bound.
See DirectX Tool Kit for DirectX 11 and DirectX 12
Upvotes: 4