So, by using DirectX 12, developers can perform these transitions over a long period of time using the ResourceBarrier API with start and end states, both having their own before and after states. Now consider an example where you want to read a render target for a number of frames. So, using this API, the developer can communicate with the GPU on the different states that we talked about earlier in this article.
In our previous article, we briefly talked about the ResourceBarrier API which supports GPU randomness. In order to demonstrate this new feature, check out a direct comparison between the DX11 and DX 12 versions of Fable Legends.įable Legends DX11 version: The app has no higher level knowledge resulting in lower frame rates than DX12 version below.įable Legends DX12 version: The app has higher level knowledge resulting in higher frame rates due to less GPU idle / dropout time. What else? Multiple uploads up to hundreds on a modern GPU can be executed in parallel followed by idle time (if applicable). So if your app doesn’t need blocking time, sends can run one after the other. Using DirectX 12, the developer is now responsible for telling the application when these idle times are needed. In DX11, whenever a developer wants to make a back-to-back dispatch call, the API will ensure that all reads and writes are complete for a given call, which will result in some inactive time before the next dispatch event occurs. This way, the developer can minimize the number of redundant state transitions, resulting in less unexpected deadlocks and performance losses. Of course, this can happen in DX11 but in an abstract way. This lets the developer know when they are asking the GPU to do the job or to move from one state to another. For example, the application will tell the GPU that the current state was a render target, but is now used as a shader resource. In DirectX 12, there is actually a built-in application that will inform the GPU of the current state of the resource. Another important thing that developers need to keep track of is the transition of resources and making sure they are in sync with each other. so that other parts of the GPU can read it efficiently. For example, if you want to read a texture from a render target, some GPUs will compress it and save bandwidth in the process, but if not, it needs to be unzipped to a different hardware state. It is common knowledge that modern GPUs work with resources in the form of states and by using those states they know where these transitions or instructions should occur in the pipeline. The first approach is called Explicit resource transitions. So how can developers get the most out of the GPU using DirectX 12? Bennett says there are three ways to do this. Not only that, it also manages to take care of resource management issues such as the order in which they will be used and how they will be used in rendering operations, resulting in impressive performance gains. During this year’s GDC, Microsoft’s Bennett Sorbo took center stage to explain how DirectX 12 is not only a low-level access API for a variety of GPU hardware, but it also has a very low level of abstraction compared to DX11. Today we’re going to focus on how DirectX 12 enables developers to efficiently use GPUs and reduce CPU overhead for better performance. THELast week we covered the new rendering features found in DirectX 12 as well as performance comparisons between DX11 and DX12.