nir: Emit set_vertex_and_primitive_count for inactive streams.

This fixes issues in backends such as ACO which rely on always
getting this intrinsic to know the correct vertex and primitive
count.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7213>
diff --git a/src/compiler/nir/nir_lower_gs_intrinsics.c b/src/compiler/nir/nir_lower_gs_intrinsics.c
index e83034b..d170f7b 100644
--- a/src/compiler/nir/nir_lower_gs_intrinsics.c
+++ b/src/compiler/nir/nir_lower_gs_intrinsics.c
@@ -293,20 +293,25 @@
          /* When it's not per-stream, we only need to write one variable. */
          if (!state->per_stream && stream != 0)
             continue;
-         /* When it's per-stream, make sure not to use inactive streams. */
-         if (state->per_stream && !(shader->info.gs.active_stream_mask & (1 << stream)))
-            continue;
 
-         if (state->overwrite_incomplete)
-            overwrite_incomplete_primitives(state, stream);
-
-         nir_ssa_def *vtx_cnt = nir_load_var(b, state->vertex_count_vars[stream]);
+         nir_ssa_def *vtx_cnt;
          nir_ssa_def *prim_cnt;
 
-         if (state->count_prims)
-            prim_cnt = nir_load_var(b, state->primitive_count_vars[stream]);
-         else
-            prim_cnt = nir_ssa_undef(b, 1, 32);
+         if (state->per_stream && !(shader->info.gs.active_stream_mask & (1 << stream))) {
+            /* Inactive stream: vertex count is 0, primitive count is 0 or undef. */
+            vtx_cnt = nir_imm_int(b, 0);
+            prim_cnt = state->count_prims
+                       ? nir_imm_int(b, 0)
+                       : nir_ssa_undef(b, 1, 32);
+         } else {
+            if (state->overwrite_incomplete)
+               overwrite_incomplete_primitives(state, stream);
+
+            vtx_cnt = nir_load_var(b, state->vertex_count_vars[stream]);
+            prim_cnt = state->count_prims
+                       ? nir_load_var(b, state->primitive_count_vars[stream])
+                       : nir_ssa_undef(b, 1, 32);
+         }
 
          nir_intrinsic_instr *set_cnt_intrin =
             nir_intrinsic_instr_create(shader,