i965: Move 3-src subnr swizzle handling into the vec4 backend.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 31 Dec 2015 20:47:19 +0000 (12:47 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Sun, 3 Jan 2016 02:46:16 +0000 (18:46 -0800)
commit53a9b6223f4ebf66e8892e04ffe47eb5586eda5c
treeb068859a2207d4b613e97d75e47054df8e2b0c21
parent64253fdb2eda545a4988c02a60627a9840c79907
i965: Move 3-src subnr swizzle handling into the vec4 backend.

While most align16 instructions only support a SubRegNum of 0 or 4
(using swizzling to control the other channels), 3-src instructions
actually support arbitrary SubRegNums.  When the RepCtrl bit is set,
we believe it ignores the swizzle and uses the equivalent of a <0,1,0>
region from the subnr.

In the past, we adopted a vec4-centric approach of specifying subnr of
0 or 4 and a swizzle, then having brw_eu_emit.c convert that to a proper
SubRegNum.  This isn't a great fit for the scalar backend, where we
don't set swizzles at all, and happily set subnrs in the range [0, 7].

This patch changes brw_eu_emit.c to use subnr and swizzle directly,
relying on the higher levels to set them sensibly.

This should fix problems where scalar sources get copy propagated into
3-src instructions in the FS backend.  I've only observed this with
TES push model inputs, but I suppose it could happen in other cases.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_eu_emit.c
src/mesa/drivers/dri/i965/brw_vec4.cpp