tgsi_exec: handle execmask when doing indirect lookups
authorDave Airlie <airlied@redhat.com>
Sun, 20 Mar 2016 22:52:14 +0000 (08:52 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 30 Mar 2016 23:13:46 +0000 (09:13 +1000)
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/auxiliary/tgsi/tgsi_exec.c

index 126259fc0f86612c5a990a8df94fde7c210c93c8..a44a05c49f4f4e8150e031c3236a2084117d036d 100644 (file)
@@ -1995,11 +1995,11 @@ fetch_sampler_unit(struct tgsi_exec_machine *mach,
                    uint sampler)
 {
    uint unit;
-
+   int i;
    if (inst->Src[sampler].Register.Indirect) {
       const struct tgsi_full_src_register *reg = &inst->Src[sampler];
       union tgsi_exec_channel indir_index, index2;
-
+      const uint execmask = mach->ExecMask;
       index2.i[0] =
       index2.i[1] =
       index2.i[2] =
@@ -2012,7 +2012,13 @@ fetch_sampler_unit(struct tgsi_exec_machine *mach,
                              &index2,
                              &ZeroVec,
                              &indir_index);
-      unit = inst->Src[sampler].Register.Index + indir_index.i[0];
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
+         if (execmask & (1 << i)) {
+            unit = inst->Src[sampler].Register.Index + indir_index.i[i];
+            break;
+         }
+      }
+
    } else {
       unit = inst->Src[sampler].Register.Index;
    }