diff options
author | Francisco Jerez <[email protected]> | 2016-02-26 17:12:27 -0800 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2016-03-06 12:22:40 -0800 |
commit | ff7a2b489e6a8f3f63f71f36cd63d91cd81c326d (patch) | |
tree | ff3803b21036c877bc9be5f8d3cbd0442da43b49 /src/mesa/drivers/dri/i965/brw_ir_vec4.h | |
parent | 537d3df97466835ad6438fe2c9121283e0da1bcd (diff) |
i965: Add support for swizzling arbitrary immediates to (brw_)swizzle().
Scalar immediates used to be handled correctly by swizzle() (as the
identity) but since commit 58fa9d47b536403c4e3ca5d6a2495691338388fd it
will corrupt the contents of the immediate. Vector immediates were
never handled correctly, but we had ad-hoc code to swizzle VF
immediates in the vec4 copy propagation pass. This takes care of
swizzling V and UV in addition.
v2: Don't implement swizzling of V/UV immediates (Matt). If you need
to swizzle an integer vector immediate in the future apply the
following diff to go back to v1:
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -119,11 +119,10 @@ brw_swap_cmod(uint32_t cmod)
static unsigned
imm_shift(enum brw_reg_type type, unsigned i)
{
- assert(type != BRW_REGISTER_TYPE_UV && type != BRW_REGISTER_TYPE_V &&
- "Not implemented.");
-
if (type == BRW_REGISTER_TYPE_VF)
return 8 * (i & 3);
+ else if (type == BRW_REGISTER_TYPE_UV || type == BRW_REGISTER_TYPE_V)
+ return 4 * (i & 7);
else
return 0;
}
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_ir_vec4.h')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_ir_vec4.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h b/src/mesa/drivers/dri/i965/brw_ir_vec4.h index 660becaafa7..2b6872e6d31 100644 --- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h @@ -76,7 +76,11 @@ offset(src_reg reg, unsigned delta) static inline src_reg swizzle(src_reg reg, unsigned swizzle) { - reg.swizzle = brw_compose_swizzle(swizzle, reg.swizzle); + if (reg.file == IMM) + reg.ud = brw_swizzle_immediate(reg.type, reg.ud, swizzle); + else + reg.swizzle = brw_compose_swizzle(swizzle, reg.swizzle); + return reg; } |