tgsi: handle SOA dependencies for MOV/SWZ
authorBrian Paul <brianp@vmware.com>
Thu, 20 Aug 2009 16:28:22 +0000 (10:28 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 20 Aug 2009 16:52:12 +0000 (10:52 -0600)
commit013bd4da1a4c112334c0b658f2506446df3666a6
tree1a968fccdc11d1ce09993be581a6427b34a7da22
parentfffcecc4d93253b077479d5f550a8fc5c20e54cd
tgsi: handle SOA dependencies for MOV/SWZ

SOA dependencies can happen when a register is used both as a source and
destination and the source is swizzled.  For example:

MOV T, T.yxwz; would expand into:

  MOV t0, t1;
  MOV t1, t0;
  MOV t2, t3;
  MOV t3, t2;

The second instruction will produce the wrong result since we wrote to t0
in the first instruction.  We need to use an intermediate temporary to fix
this.

This will take more work to fix for all TGSI instructions.  This seems to
happen with MOV instructions more than anything else so fix that case now
and warn on others.

Fixes piglit glsl-vs-loop test (when not using SSE). See bug 23317.
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/auxiliary/tgsi/tgsi_exec.h