mesa/st: simplify st_can_add_pointsize_to_program iterator
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 4 Apr 2022 23:08:13 +0000 (19:08 -0400)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 8 Apr 2022 01:56:10 +0000 (21:56 -0400)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>

src/mesa/state_tracker/st_program.c

index 0b750c4ff30d2bdc84a5d890aa341032ba8b48af..5a7147809e9786a67efaa47a5dce6a53cb1943a1 100644 (file)
@@ -1929,12 +1929,7 @@ st_can_add_pointsize_to_program(struct st_context *st, struct gl_program *prog)
                              st->ctx->Const.Program[nir->info.stage].MaxOutputComponents * 4;
    unsigned num_components = 0;
    unsigned needed_components = nir->info.stage == MESA_SHADER_GEOMETRY ? nir->info.gs.vertices_out : 1;
-   u_foreach_bit64(loc, nir->info.outputs_written) {
-      nir_variable *var = NULL;
-      unsigned location = loc; //can't modify bit iterator
-      while (!var)
-         var = nir_find_variable_with_location(nir, nir_var_shader_out, location--);
-      assert(var);
+   nir_foreach_shader_out_variable(var, nir) {
       num_components += glsl_count_dword_slots(var->type, false);
    }
    /* Ensure that there is enough attribute space to emit at least one primitive */