i965/fs: Add support for ir_tg4
authorChris Forbes <chrisf@ijw.co.nz>
Sun, 31 Mar 2013 08:33:51 +0000 (21:33 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Wed, 2 Oct 2013 18:55:56 +0000 (07:55 +1300)
commit942a4ec18f7e713b962e7acc451fbd50ff9c4042
tree9e5f23c1ec40d4398633d8e047db699cd39e8e1e
parentfb455500bfb11cca0f45076a9eaccc0ddd764731
i965/fs: Add support for ir_tg4

Lowers ir_tg4 (from textureGather and textureGatherOffset builtins) to
SHADER_OPCODE_TG4.

The usual post-sampling swizzle workaround can't work for ir_tg4,
so avoid doing that:

* For R/G/B/A swizzles use the hardware channel select (lives in the
   same dword in the header as the texel offset), and then don't do
   anything afterward in the shader.
* For 0/1 swizzles blast the appropriate constant over all the output
   channels instead of sampling.

V2: Avoid duplicating header enabling block
V3: Avoid sampling at all, for degenerate swizzles.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp