Skip to content

Draft: nir: Allow load_ubo in nir_opt_peephole_select

Alyssa Rosenzweig requested to merge alyssa/mesa:jnir2 into master

Needed to avoid a regression in code quality when setting lower_uniform_to_ubos. Most pronounced example of an affected shader is found in shader-db/glamor/73.shader_test, which reads the same uniform on both sides of the if.

Generally, Vulkan-capable hardware does not have a firm concept of uniforms. Uniform buffer objects will map to hardware, and something resembling push constants will be exposed. GL drivers implement uniforms as either push constants or uniform buffer objects. Sophisticated implementations will wish to lower all uniforms to UBOs and then push the best ranges, without necessarily distinguishing application-defined uniforms from application-defined UBOs. As such, considering load_uniform to be cheap but load_ubo to be expensive is silly for this class of hardware, since either intrinsic can map to either hardware mechanism. [Currently, Intel and Freedreno perform UBO range analysis. I have a WIP branch for Panfrost this commit is cherry-picked from. I believe v3d could theoretically implement this optimization.]

Signed-off-by: Alyssa Rosenzweig alyssa.rosenzweig@collabora.com

Edited by Alyssa Rosenzweig

Merge request reports