Skip to content

nir, radv: Add ability to remove built-in IO variables during shader linking.

Timur Kristóf requested to merge Venemo/mesa:radv_io_remove_builtins into main

The motivation for this work is to eliminate useless output writes from shaders, as well as to better align the producer's outputs_written with the consumer's inputs_read during shader linking.

Mostly useful when the pipeline has tessellation and/or geometry for pre-rasterization stages except the last one. Oftentimes some of the pre-rasterization stages write some built-in outputs (such as position) which are not read by the next stage. These can be safely removed. Also allows removing primitive ID when the pipeline has GS or MS.

Also includes a small patch to nir_lower_io_to_temporaries that helps keep some shader info up to date so that the compiler stack doesn't think shaders read their own outputs after that pass.

Edited by Timur Kristóf

Merge request reports