freedreno/ir3: small cleanup
[mesa.git] / src / freedreno / ir3 / ir3_nir.c
index 23dabee1fb020068cee5724d241d15825d74f152..437f196bbe0504221748f41baa0dd2808bc3ef80 100644 (file)
@@ -54,7 +54,6 @@ static const nir_shader_compiler_options options = {
                .lower_helper_invocation = true,
                .lower_bitfield_insert_to_shifts = true,
                .lower_bitfield_extract_to_shifts = true,
-               .lower_bfm = true,
                .use_interpolated_input_intrinsics = true,
 };
 
@@ -79,7 +78,6 @@ static const nir_shader_compiler_options options_a6xx = {
                .lower_helper_invocation = true,
                .lower_bitfield_insert_to_shifts = true,
                .lower_bitfield_extract_to_shifts = true,
-               .lower_bfm = true,
                .use_interpolated_input_intrinsics = true,
 };
 
@@ -174,7 +172,7 @@ ir3_optimize_loop(nir_shader *s)
        } while (progress);
 }
 
-struct nir_shader *
+void
 ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
                const struct ir3_shader_key *key)
 {
@@ -281,8 +279,6 @@ ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
        if (!key) {
                ir3_setup_const_state(shader, s);
        }
-
-       return s;
 }
 
 static void
@@ -330,6 +326,13 @@ ir3_nir_scan_driver_consts(nir_shader *shader,
                                                layout->image_dims.count;
                                        layout->image_dims.count += 3; /* three const per */
                                        break;
+                               case nir_intrinsic_load_ubo:
+                                       if (nir_src_is_const(intr->src[0])) {
+                                               layout->num_ubos = MAX2(layout->num_ubos,
+                                                               nir_src_as_uint(intr->src[0]) + 1);
+                                       } else {
+                                               layout->num_ubos = shader->info.num_ubos;
+                                       }
                                default:
                                        break;
                                }
@@ -348,9 +351,6 @@ ir3_setup_const_state(struct ir3_shader *shader, nir_shader *nir)
 
        ir3_nir_scan_driver_consts(nir, const_state);
 
-       const_state->num_uniforms = nir->num_uniforms;
-       const_state->num_ubos = nir->info.num_ubos;
-
        debug_assert((shader->ubo_state.size % 16) == 0);
        unsigned constoff = align(shader->ubo_state.size / 16, 4);
        unsigned ptrsz = ir3_pointer_size(compiler);