diff options
author | Kenneth Graunke <[email protected]> | 2012-02-08 16:59:39 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2012-02-29 14:57:26 -0800 |
commit | e568b00562cf38afd779560c7431a94672531e95 (patch) | |
tree | 0987ffbc6fb5c9ca9e18f2806c26d290b477e3c4 /src/mesa | |
parent | 1e6a2c10590bc6b4112ec2e54e1de7d8f9fd349d (diff) |
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 <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index f9a08a011f2..cb4cb877b66 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -1402,6 +1402,10 @@ vec4_visitor::visit(ir_dereference_variable *ir) this->result = src_reg(*reg); + /* System values get their swizzle from the dst_reg writemask */ + if (ir->var->mode == ir_var_system_value) + return; + if (type->is_scalar() || type->is_vector() || type->is_matrix()) this->result.swizzle = swizzle_for_size(type->vector_elements); } |