Full-speed, out-of-order rasterization
If you’re familiar with graphics APIs, you’re certainly aware of the API ordering guarantees. At their core, these guarantees mean that if you put two triangles into the pipeline one after the other, they will also end up in the framebuffer in exactly the same order. This makes it possible, for instance, to sort transparent geometry by depth and get the correct blending.
While this guarantee is usually necessary for correctness, it’s often an unnecessary constraint. If you’re laying down a G-Buffer without blending, for example, you typically don’t care about a specific rasterization order. The same commonly applies to depth-only rendering operations. For those cases, GCN hardware supports a special “out-of-order” rasterization mode which does exactly what the name implies: it relaxes the ordering guarantee, and allows fragments to be produced out-of-order. This can improve efficiency in various cases, and in fact, the driver will try to enable it automatically when it is safe to do so.
However, there are some cases when forcing Out of Order Rasterization at the driver level is not safe. For instance, if you’re rendering with a less-or-equal depth test. In this case, out-of-order rendering will produce different results, as any geometry which is Z-fighting in the less-or-equal case is no longer guaranteed to produce the same results. Because you probably don’t care about the specific pattern of your Z-buffer artifacts (or you know that your scene doesn’t produce them) enabling out-of-order rasterization manually is fine – but it’s a case where the driver can’t do it.
Today, we’re introducing a new Vulkan extension, VK_AMD_rasterization_order which allows you to control out-of-order rendering on a per-draw-call basis. It’s a new rasterization state, which you can turn on for everything that does not require strict primitive ordering. This will be generally every G-Buffer pass, all shadow map rendering, and passes that enable commutative blending. In those cases, you can turn on RELAXED order.
....