Skip to content

fix nir_lower_int_to_float

Jonathan Marek requested to merge flto/mesa:nir-fix-intfloat into master

This is my attempt to fix the recently added nir_lower_int_to_float (integrating the WIP version I already had). This passes deqp gles2 tests (result).

This fixes the following problems (at least):

  • Missing ftrunc/ffloor when lowering float to int cast
  • gather_ssa_types failing for load_input/store_output intrinsics (always float on gles2)
  • gather_ssa_types failing when a constant is used both as integer and float (it often happens with the value 0). 0 is the same value when cast to float but vecN/bcsel gets the wrong type and other constants get converted incorrectly.
  • freedreno/a2xx wasn't updated to use it

With this implementation nir_lower_int_to_float does not do the bool to float lowering. Two separate passes allows for better validation and less issues. On etnaviv for example, ftrunc lowering creates instructions with bools, which makes an annoying situation if it is a single pass as int to float can produce ftrunc instructions (int_to_float can't be used twice because gather_ssa_types will give the wrong type for load_uniform source for example).

I am hoping @jekstrand has better ideas on how to fix gather_ssa_types than the hacks I have.

@jekstrand @austriancoder @anarsoul

Edited by Jonathan Marek

Merge request reports