Skip to content

nir/lower_int_to_float: Add support for shifts.

Emma Anholt requested to merge anholt/mesa:ntt-float-shr into master

With the prog-to-nir conversion of mesa/st, non-NIR drivers now have their ARB programs go through nir_to_tgsi. The ARB program state vars go through lower_uniforms_to_ubo, and on non-PIPE_CAP_LOAD_CONSTBUF drivers we then go through nir_lower_ubo_vec4 to get TGSI-appropriate addressing. Those two passes multiply uniform array indexes by 16 (vec4 -> byte) and shift back down (byte -> vec4). On non-PIPE_SHADER_CAP_INTEGERS drivers, if NIR didn't optimize out those shifts (because the double-shift might to mask off the top bits) then the lower-to-float path would have shl and shr operations left. This caused assertion failures on indirect addressing on these drivers.

@charmainel here's a completely untested fix that might get your piglits unregressed.

Merge request reports