The attachment method of VK_KHR_fragment_shading_rate
(FSR) extension seems to be similar to VK_EXT_fragment_density_map
(FDM) extension.
One of the differences is in the way shading rate is defined. In FSR, fragment size is encoded directly in the texel value using bitwise operations whereas in FDM a density value (0-255) is provided and the implementation converts that into a fragment size. Are there any other differences? From an application developer's point of view, are they functionally the same?
There seems to be some discussion here but no definite answer.
It is probably a little too late but let me try to explain it from the top of my head.
Both FSR/VRS and FDM are similar in a sense that they use an image resource that describes the rates to use per every tile of pixels of the viewport. The viewport is divided into tiles of X by Y pixels. For every tile, there is a texel in the image resource that sets the size of the fragments included that tile.
The size of the tile in pixels is a.k.a. the texel size of the image resource. The maximum and minimum tile sizes are dependent on the specific GPU.
In FDM, for a given texel size (tile of X by Y pixels), you get a value that will ultimately be used to get a fragment size. That fragment size is used both in rasterization and fragment shading. What does it mean?
In FDM we are making bigger pixels, which are multiple of the original pixel size. We are effectively locally lowering the resolution of the rasterization, which increases staircase artifacts for example. As the pixels are bigger, you will require less fragment shading to "colour" the scene.
In FSR, for a given texel size (tile of X by Y pixels), you get a value that is directly the fragment size coded in log2. The fragment size is defined by the corresponding texel of the image resource. In this case, the rasterization is performed at the original resolution, so the shapes of the objects are respected and staircase artifacts are not exacerbated. But we do increase the size of the fragment, thus reducing the amount of fragment shading needed. Before FSR, a fragment would cover a single pixel. With FSR we increase the size of the fragment, that now expands a subtile of pixels (commonly from 1x1 to 4x4 pixels).
So, they are pretty similar. Both reduce fragment shading. Which one is better? It depends on the workload and the specific GPU. In my experience the image quality tends to be better with FSR w.r.t. FDM. Rasterization is faster with FDM, but the rasterizer is not usually the bottleneck in a GPU...
I would use FSR, as it has been much widely adopted than FDM. But again, it will still depend on your workload requirements and the GPU you are developing for.
I hope this helps!