i965: Fix swizzles for system values such as gl_InstanceID.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 9 Feb 2012 00:59:39 +0000 (16:59 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 29 Feb 2012 22:57:26 +0000 (14:57 -0800)
commite568b00562cf38afd779560c7431a94672531e95
tree0987ffbc6fb5c9ca9e18f2806c26d290b477e3c4
parent1e6a2c10590bc6b4112ec2e54e1de7d8f9fd349d
i965: Fix swizzles for system values such as gl_InstanceID.

visit(ir_variable *) sets dst_reg::writemask to the appropriate channel
for system values.  Unfortunately, visit(ir_dereference_variable *) then
calls swizzle_for_size, which for a float, sets the swizzle to .x.

This works for gl_VertexID, since we store it in the .x component (see
brw_draw_upload.c:732 - VID), but fails for gl_InstanceID (IID) since we
store it in the .y channel.

To fix this, avoid calling swizzle_for_size on ir_var_system_values.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp