Skip to content

nir,glsl: add nir_opt_vectorize_io, fix lower_io_to_scalar, vectorize IO in the GLSL linker

Marek Olšák requested to merge mareko/mesa:vectorize-io into main

We generally want vectorized IO coming out of the GLSL linker. Since the linker scalarizes for nir_opt_varyings, it had no way to re-vectorize IO until now.


  • vectorizes lowered input/output loads and stores
  • vectorizes low and high 16-bit loads and stores by merging them into a single 32-bit load or store (except load_interpolated_input, which has to keep bit_size=16)
  • performs DCE of output stores that overwrite the previous value by writing into the same slot and component.

Vectorization is only local within basic blocks. No vectorization occurs across basic block boundaries, barriers (only TCS outputs), emits (only GS outputs), and output load <-> output store dependencies.

All loads and stores must be scalar before the pass. 64-bit loads and stores are forbidden.

For each basic block, the time complexity is O(n*log(n)) where n is the number of IO instructions within that block.

Merge request reports