diff options
author | Jason Ekstrand <[email protected]> | 2015-05-05 15:57:11 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-05-06 10:29:29 -0700 |
commit | cf4607e85339c3cfd6ab5fd4a28985c9fafb0b86 (patch) | |
tree | cc81f8837904794e0c3d00157628279ca6827cda | |
parent | 88414de45e723a7fe8f052a3ab616aa7bc568519 (diff) |
i965/fs: Make half(fs_reg, unsigned) handle register files more explicitly
Previously, we had a special case for uniforms and immediates and then a
bunch of asserts for various other pessimal things. This commit changes it
so that it explicitly does something on each register file. Some of them
are disallowed and others are treated properly.
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_ir_fs.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h index acbf617cfa6..9ebe9808dda 100644 --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h @@ -183,13 +183,24 @@ half(fs_reg reg, unsigned idx) { assert(idx < 2); - if (reg.file == UNIFORM || reg.file == IMM) + switch (reg.file) { + case BAD_FILE: + case UNIFORM: + case IMM: return reg; - assert(idx == 0 || reg.file != HW_REG); - assert(reg.width == 16); - reg.width = 8; - return horiz_offset(reg, 8 * idx); + case GRF: + case MRF: + assert(reg.width == 16); + reg.width = 8; + return horiz_offset(reg, 8 * idx); + + case ATTR: + case HW_REG: + default: + unreachable("Cannot take half of this register type"); + } + return reg; } static const fs_reg reg_undef; |