tgsi_to_nir: fix masked out image loads
authorMarek Olšák <marek.olsak@amd.com>
Wed, 18 Sep 2019 21:34:13 +0000 (17:34 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 23 Sep 2019 19:34:54 +0000 (15:34 -0400)
This caused a failure in NIR validation.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/auxiliary/nir/tgsi_to_nir.c

index b5ca49336afde49643e10d2c42b1060b162f407c..b92a4485e4c0b29a1afe69ce82b61ef96ffebd3a 100644 (file)
@@ -1939,8 +1939,7 @@ ttn_mem(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
 
 
    if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_LOAD) {
-      nir_ssa_dest_init(&instr->instr, &instr->dest,
-                        util_last_bit(tgsi_inst->Dst[0].Register.WriteMask),
+      nir_ssa_dest_init(&instr->instr, &instr->dest, instr->num_components,
                         32, NULL);
       nir_builder_instr_insert(b, &instr->instr);
       ttn_move_dest(b, dest, &instr->dest.ssa);