Skip to content

gallivm/nir: Lower uniforms to UBOs in llvm draw call if the driver didn't request this already

Gert Wollny requested to merge gerddie/mesa:gallivm-lower-uniforms into master

When the llvm draw engine is used for draw shaders in st_program the driver may not enable the cap PIPE_CAP_PACKED_UNIFORMS, so uniforms are not be lowered to UBOs. However, llvm doesn't support nir_load_uniform, so lower the uniforms to UBO now. The multiplier is set to 16 to be the same like in the TGSI code path.

RFC because I'm not sure why the shader would be routed through llvmpipe and I'm also not sure whether this shader could also be used later again in the "normal" driver. If this is so then lowering uniforms to UBO without creating a variant of the shader first might lead to problems in that driver, because it did not set PIPE_CAP_PACKED_UNIFORMS and probably doesn't expect the uniforms to be lowered to UBOs.

Edited by Gert Wollny

Merge request reports