summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_ir_fs.h
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2016-05-11 12:54:26 -0700
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>2016-05-16 09:55:33 +0200
commit71fd4942d10128afde9f0a7f33b587c29cd9011c (patch)
treebb5d7a173690eb55a99a439fe2927bdfcae55fc9 /src/mesa/drivers/dri/i965/brw_ir_fs.h
parente209134f717078fb6c1d4a6d048b4aba22c87993 (diff)
downloadexternal_mesa3d-71fd4942d10128afde9f0a7f33b587c29cd9011c.zip
external_mesa3d-71fd4942d10128afde9f0a7f33b587c29cd9011c.tar.gz
external_mesa3d-71fd4942d10128afde9f0a7f33b587c29cd9011c.tar.bz2
i965/fs: Fix and document component().
This fixes a number of bugs of component() by reimplementing it in terms of horiz_offset(): Handling of base registers starting at a non-zero subreg_offset, handling of strided registers and overflow of subreg_offset into reg_offset. Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_ir_fs.h')
-rw-r--r--src/mesa/drivers/dri/i965/brw_ir_fs.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 305d91c..3d47b0c 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -128,11 +128,14 @@ horiz_offset(fs_reg reg, unsigned delta)
return reg;
}
+/**
+ * Get the scalar channel of \p reg given by \p idx and replicate it to all
+ * channels of the result.
+ */
static inline fs_reg
component(fs_reg reg, unsigned idx)
{
- assert(reg.subreg_offset == 0);
- reg.subreg_offset = idx * type_sz(reg.type);
+ reg = horiz_offset(reg, idx);
reg.stride = 0;
return reg;
}