lima: use int_to_float lowering pass
authorVasily Khoruzhick <anarsoul@gmail.com>
Wed, 1 May 2019 05:25:23 +0000 (22:25 -0700)
committerQiang Yu <yuq825@gmail.com>
Tue, 7 May 2019 01:07:27 +0000 (01:07 +0000)
Neither GP nor PP in Mali4x0 support integers, so utilize new pass
and set native_integers to true for now until this flag is dropped.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
src/gallium/drivers/lima/lima_program.c

index 98416471e6758af658dc54549b32a11ffc28564e..21e64fb6aafcd3fed8b7a41ef0dd804c37a7cdc9 100644 (file)
@@ -49,6 +49,7 @@ static const nir_shader_compiler_options vs_nir_options = {
    .lower_flrp64 = true,
    /* could be implemented by clamp */
    .lower_fsat = true,
+   .native_integers = true,
 };
 
 static const nir_shader_compiler_options fs_nir_options = {
@@ -58,6 +59,7 @@ static const nir_shader_compiler_options fs_nir_options = {
    .lower_flrp32 = true,
    .lower_flrp64 = true,
    .lower_fsign = true,
+   .native_integers = true,
 };
 
 const void *
@@ -90,7 +92,6 @@ lima_program_optimize_vs_nir(struct nir_shader *s)
    NIR_PASS_V(s, lima_nir_lower_uniform_to_scalar);
    NIR_PASS_V(s, nir_lower_io_to_scalar,
               nir_var_shader_in|nir_var_shader_out);
-   NIR_PASS_V(s, nir_lower_bool_to_float);
 
    do {
       progress = false;
@@ -113,6 +114,8 @@ lima_program_optimize_vs_nir(struct nir_shader *s)
                nir_var_function_temp);
    } while (progress);
 
+   NIR_PASS_V(s, nir_lower_int_to_float);
+   NIR_PASS_V(s, nir_copy_prop);
    NIR_PASS_V(s, nir_lower_locals_to_regs);
    NIR_PASS_V(s, nir_convert_from_ssa, true);
    NIR_PASS_V(s, nir_remove_dead_variables, nir_var_function_temp);
@@ -127,7 +130,6 @@ lima_program_optimize_fs_nir(struct nir_shader *s)
    NIR_PASS_V(s, nir_lower_fragcoord_wtrans);
    NIR_PASS_V(s, nir_lower_io, nir_var_all, type_size, 0);
    NIR_PASS_V(s, nir_lower_regs_to_ssa);
-   NIR_PASS_V(s, nir_lower_bool_to_float);
 
    do {
       progress = false;
@@ -150,6 +152,8 @@ lima_program_optimize_fs_nir(struct nir_shader *s)
                nir_var_function_temp);
    } while (progress);
 
+   NIR_PASS_V(s, nir_lower_int_to_float);
+
    /* Lower modifiers */
    NIR_PASS_V(s, nir_lower_to_source_mods, nir_lower_all_source_mods);
    NIR_PASS_V(s, nir_copy_prop);