turnip: Make tu_android.c compile again
[mesa.git] / src / freedreno / ir3 / ir3_nir.c
index f37d29947997e5349ada7e5b2ca2c34e7562772a..dc707545bbb6a629aa25a15a4c775e7f312e1424 100644 (file)
@@ -71,6 +71,12 @@ static const nir_shader_compiler_options options = {
                .lower_to_scalar = true,
                .has_imul24 = true,
                .lower_wpos_pntc = true,
+
+               /* Only needed for the spirv_to_nir() pass done in ir3_cmdline.c
+                * but that should be harmless for GL since 64b is not
+                * supported there.
+                */
+               .lower_int64_options = (nir_lower_int64_options)~0,
 };
 
 /* we don't want to lower vertex_id to _zero_based on newer gpus: */
@@ -115,6 +121,12 @@ static const nir_shader_compiler_options options_a6xx = {
                .has_imul24 = true,
                .max_unroll_iterations = 32,
                .lower_wpos_pntc = true,
+
+               /* Only needed for the spirv_to_nir() pass done in ir3_cmdline.c
+                * but that should be harmless for GL since 64b is not
+                * supported there.
+                */
+               .lower_int64_options = (nir_lower_int64_options)~0,
 };
 
 const nir_shader_compiler_options *
@@ -194,6 +206,7 @@ ir3_optimize_loop(nir_shader *s)
                        OPT(s, nir_opt_dce);
                }
                progress |= OPT(s, nir_opt_if, false);
+               progress |= OPT(s, nir_opt_loop_unroll, nir_var_all);
                progress |= OPT(s, nir_opt_remove_phis);
                progress |= OPT(s, nir_opt_undef);
        } while (progress);
@@ -309,7 +322,7 @@ static bool
 ir3_nir_lower_layer_id(nir_shader *nir)
 {
        unsigned layer_id_loc = ~0;
-       nir_foreach_variable(var, &nir->inputs) {
+       nir_foreach_shader_in_variable(var, nir) {
                if (var->data.location == VARYING_SLOT_LAYER) {
                        layer_id_loc = var->data.driver_location;
                        break;
@@ -379,7 +392,7 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s)
                        break;
                case MESA_SHADER_TESS_CTRL:
                        NIR_PASS_V(s, ir3_nir_lower_tess_ctrl, so, so->key.tessellation);
-                       NIR_PASS_V(s, ir3_nir_lower_to_explicit_input);
+                       NIR_PASS_V(s, ir3_nir_lower_to_explicit_input, so->shader->compiler);
                        progress = true;
                        break;
                case MESA_SHADER_TESS_EVAL:
@@ -389,7 +402,7 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s)
                        progress = true;
                        break;
                case MESA_SHADER_GEOMETRY:
-                       NIR_PASS_V(s, ir3_nir_lower_to_explicit_input);
+                       NIR_PASS_V(s, ir3_nir_lower_to_explicit_input, so->shader->compiler);
                        progress = true;
                        break;
                default:
@@ -411,7 +424,7 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s)
                        progress |= OPT(s, ir3_nir_lower_layer_id);
        }
        if (so->key.color_two_side) {
-               OPT_V(s, nir_lower_two_sided_color);
+               OPT_V(s, nir_lower_two_sided_color, true);
                progress = true;
        }
 
@@ -502,6 +515,8 @@ ir3_nir_scan_driver_consts(nir_shader *shader,
 
                                switch (intr->intrinsic) {
                                case nir_intrinsic_get_buffer_size:
+                                       if (ir3_bindless_resource(intr->src[0]))
+                                               break;
                                        idx = nir_src_as_uint(intr->src[0]);
                                        if (layout->ssbo_size.mask & (1 << idx))
                                                break;