Mesa (main): ac/nir: Make sure to exclude special outputs from arrayed output masks.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 25 06:51:17 UTC 2022


Module: Mesa
Branch: main
Commit: a84789f7959834085c42e0b9c55d3bf5963d6614
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a84789f7959834085c42e0b9c55d3bf5963d6614

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Thu Jan 20 16:43:45 2022 +0100

ac/nir: Make sure to exclude special outputs from arrayed output masks.

Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15034>

---

 src/amd/common/ac_nir_lower_ngg.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c
index 3d88a5b88aa..193faf76ec5 100644
--- a/src/amd/common/ac_nir_lower_ngg.c
+++ b/src/amd/common/ac_nir_lower_ngg.c
@@ -2304,6 +2304,9 @@ ms_emit_arrayed_outputs(nir_builder *b,
    nir_ssa_def *zero = nir_imm_int(b, 0);
 
    u_foreach_bit64(slot, arrayed_outputs_mask) {
+      /* Should not occour here, handled separately. */
+      assert(slot != VARYING_SLOT_PRIMITIVE_COUNT && slot != VARYING_SLOT_PRIMITIVE_INDICES);
+
       const nir_io_semantics io_sem = { .location = slot, .num_slots = 1 };
       const unsigned driver_location = s->output_info[slot].driver_location;
       unsigned component_mask = s->output_info[slot].components_mask;
@@ -2570,10 +2573,13 @@ ac_nir_lower_ngg_ms(nir_shader *shader,
    unsigned vertices_per_prim =
       num_mesh_vertices_per_primitive(shader->info.mesh.primitive_type);
 
-   uint64_t per_vertex_outputs = shader->info.outputs_written & ~shader->info.per_primitive_outputs
-                                 & ~BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_COUNT)
-                                 & ~BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_INDICES);
-   uint64_t per_primitive_outputs = shader->info.per_primitive_outputs & shader->info.outputs_written;
+   uint64_t special_outputs =
+      BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_COUNT) | BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_INDICES);
+   uint64_t per_vertex_outputs =
+      shader->info.outputs_written & ~shader->info.per_primitive_outputs & ~special_outputs;
+   uint64_t per_primitive_outputs =
+      shader->info.per_primitive_outputs & shader->info.outputs_written & ~special_outputs;
+
    unsigned num_per_vertex_outputs = util_bitcount64(per_vertex_outputs);
    unsigned num_per_primitive_outputs = util_bitcount64(per_primitive_outputs);
    unsigned max_vertices = shader->info.mesh.max_vertices_out;



More information about the mesa-commit mailing list