ilo: correctly initialize undefined registers in fs
authorChia-I Wu <olvaffe@gmail.com>
Wed, 10 Jul 2013 22:39:05 +0000 (06:39 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Wed, 10 Jul 2013 23:01:51 +0000 (07:01 +0800)
Initialize all 4 channels of undefined registers (that is, TEMPs that are used
before being assigned) in FS.

src/gallium/drivers/ilo/shader/toy_tgsi.c

index ad6161d5894bce440730a8ebfd6c55c57148c73d..bf61cbbf537060cc8166b230e7af3388a5d29f45 100644 (file)
@@ -2136,11 +2136,21 @@ ra_get_src(struct toy_tgsi *tgsi,
                struct toy_dst dst = tdst_from(src);
                dst.writemask = TOY_WRITEMASK_XYZW;
 
-               /*
-                * Always initialize registers.  Otherwise, if the random value
-                * ends up in a VUE, FS may fail to interpolate correctly.
-                */
-               tc_MOV(tgsi->tc, dst, tsrc_type(tsrc_imm_d(0), type));
+               /* always initialize registers before use */
+               if (tgsi->aos) {
+                  tc_MOV(tgsi->tc, dst, tsrc_type(tsrc_imm_d(0), type));
+               }
+               else {
+                  struct toy_dst tdst[4];
+                  int i;
+
+                  tdst_transpose(dst, tdst);
+
+                  for (i = 0; i < 4; i++) {
+                     tc_MOV(tgsi->tc, tdst[i],
+                           tsrc_type(tsrc_imm_d(0), type));
+                  }
+               }
             }
             break;
          default: