In Part 6 we discussed how Command Lists allow for effective multithreaded rendering in Microsoft Direct3D* (D3D) 12. Multiple threads can generate command lists in parallel then submit them to the Command queue for serial execution on the GPU. Now we move on to Dynamic heaps.
As discussed earlier the game has control of resource renaming in order to make command generation parallel. Additionally resource renaming has been made easier in D3D 12. If you look at D3D 11 it has typed buffers, you have either a vertex, constant or index buffer. A request often made of the D3D development team by game developers is the ability to use that reserved memory however they wish. That is exactly what they did, for D3D 12 buffers are no longer typed. It is just a chunk of memory that the game can allocate as needed, in the size required, for the frame (or multiple frames). You can even allocate a heap allocator and subdivide as necessary, creating a more efficient process. D3D 12 also has a standard alignment, as long as the game uses this standard alignment all GPUs will be able to read the data. As we all know the more standardized we can make things in the realm of PCs the easier it is to create content that works well across the many variations of CPUs, GPUs and other hardware. The memory is also persistently mapped meaning the address is always known to the CPU. Allowing for more CPU parallelism as you can have a thread point the CPU to that memory and have the CPU figure out what data is required for the frame. A task that can be parallelized by the game for more efficient rendering.
The top of the diagram above is the D3D 11 style with typed buffers. Underneath is the new D3D 12 model with a heap controlled by the game. Instead of each typed buffer being in a different location of memory we see a single piece of persistence memory. Whose buffer sizes are adjusted by the game based on the rendering needs of the current or even several frames.
Next up in Part 8: CPU Parallelism
Diagrams and code samples from BUILD 2014 presentation. Created by Max McMullen, D3D Development Lead at Microsoft.