Skip to content

broadcom: stop abusing sampler index

Iago Toral requested to merge itoral/mesa:v3dv_stop_sampler_idx_abuse into main

What does this MR do and why?

This addresses #9206 (closed).

Sice lower_tex_packing (which is only used by broadcom) was added in nir_lower_tex, it has been using sampler_index to make decisions about how to unpack results from texture instructions, even for instructions that don't actually have sampler state (like txf). With !22303 (merged), there is a new backend_flags field available in nir_tex_instr that we can use instead to inform NIR about default sampler state to use with such instructions and stop relying on abusing the sampler index field.

For this we modify lower_tex_packing so that it no longer uses sampler_index to know which kind of upacking it needs to apply to the result of the texture instuction and instead it calls a callback that allows the backend to make that decision (in the case of broadcom, using the new backend_flags field if necessary).

Note: most of the broadcom changes need to be squashed into the change to the NIR lowering pass of course, but they have been separated here to ease review.

Edited by Iago Toral

Merge request reports