Skip to content

panfrost: Move the image attribute offset adjustment to a NIR pass

Boris Brezillon requested to merge bbrezillon/mesa:pan-vs-img-attr-lowering into main

What does this MR do and why?

The recent transition of panvk to vk_dynamic_graphics_state led us to rework the way we were dealing with image attributes passed to vertex shaders.

Indeed, the gallium and vulkan drivers deal with vertex attribute emission differently. The gallium driver re-emits the VS attributes on each draw, while the vulkan driver uses explicit attribute/image descriptor dirtiness tracking, and could keep the attribute array around if a new pipeline using a different number of attributes is bound. If we want to be able to do that, we need to assign a fixed offset for image attributes, such that the Vulkan descriptor lowering pass knows where the images are in the attribute table no matter the actual number of VS attributes used by the shader.

We could teach the Bifrost backend how to deal with a custom offset but doing that in a lowering pass also simplifies a bit the Midgard code.

Note that this MR doesn't change the way we do it in panvk. This will be part of the MR transitioning panvk to vk_dynamic_graphics_state, but I thought I'd submit this patch ahead, so we have the generic part sorted out before the panvk changes.

/cc @kusma @ericsmith @marysaka

Merge request reports