diff options
author | Francisco Jerez <[email protected]> | 2013-09-11 14:19:47 -0700 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2013-10-29 12:40:56 -0700 |
commit | d58bd7526326dfa59a9ee52f328ecd5539b8610b (patch) | |
tree | 1883bc8317db2af65525b1f743817d40e4dfd428 /src | |
parent | 5e621cb9fef7eada5a3c131d27f5b0b142658758 (diff) |
i965: Add brw_reg constructors taking a dynamically determined vector width.
The MRF variant is going to be used extensively by the atomic counter
intrinsics to assemble untyped atomic and surface read messages
easily.
Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_reg.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h index 3ee3543d4e4..e9cf892f2ee 100644 --- a/src/mesa/drivers/dri/i965/brw_reg.h +++ b/src/mesa/drivers/dri/i965/brw_reg.h @@ -282,6 +282,24 @@ brw_vec1_reg(unsigned file, unsigned nr, unsigned subnr) WRITEMASK_X); } +static inline struct brw_reg +brw_vecn_reg(unsigned width, unsigned file, unsigned nr, unsigned subnr) +{ + switch (width) { + case 1: + return brw_vec1_reg(file, nr, subnr); + case 2: + return brw_vec2_reg(file, nr, subnr); + case 4: + return brw_vec4_reg(file, nr, subnr); + case 8: + return brw_vec8_reg(file, nr, subnr); + case 16: + return brw_vec16_reg(file, nr, subnr); + default: + assert(!"Invalid register width"); + } +} static inline struct brw_reg retype(struct brw_reg reg, unsigned type) @@ -570,6 +588,12 @@ brw_message_reg(unsigned nr) return brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, nr, 0); } +static inline struct brw_reg +brw_uvec_mrf(unsigned width, unsigned nr, unsigned subnr) +{ + return retype(brw_vecn_reg(width, BRW_MESSAGE_REGISTER_FILE, nr, subnr), + BRW_REGISTER_TYPE_UD); +} /* This is almost always called with a numeric constant argument, so * make things easy to evaluate at compile time: |