diff options
author | Eric Anholt <[email protected]> | 2011-11-23 10:13:39 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-11-30 11:23:26 -0800 |
commit | a3b8c5ed5bd591d4ae7d215f71f039d3b19200bb (patch) | |
tree | add34277d4bf25c25db8f083502bd486ff4f73d1 /src | |
parent | c6abde211fa875f90e59e3709720cfe394669069 (diff) |
i965/fs: Make register file enum 0 be the undefined register file.
In 6d874d0ee18b3694c49e0206fa519bd8b746ec24, I checked whether a
register that had been stored was BAD_FILE (as opposed to a legitimate
GRF), but actually the unset register was ARF NULL because it had been
memset to 0. Finding BAD_FILE for unset values in debugging was my
intention with that file, so make it the case more often by
rearranging the enum. There was only one place we relied on the magic
enum register_file to hardware register file correspondance anyway.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_emit.cpp | 21 |
2 files changed, 25 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index de3164457c8..cb93885efe7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -48,13 +48,13 @@ extern "C" { #include "glsl/ir.h" enum register_file { - ARF = BRW_ARCHITECTURE_REGISTER_FILE, - GRF = BRW_GENERAL_REGISTER_FILE, - MRF = BRW_MESSAGE_REGISTER_FILE, - IMM = BRW_IMMEDIATE_VALUE, + BAD_FILE, + ARF, + GRF, + MRF, + IMM, FIXED_HW_REG, /* a struct brw_reg */ UNIFORM, /* prog_data->params[reg] */ - BAD_FILE }; class fs_reg { @@ -159,7 +159,7 @@ public: struct brw_reg fixed_hw_reg; int smear; /* -1, or a channel of the reg to smear to all channels. */ - /** Value for file == BRW_IMMMEDIATE_FILE */ + /** Value for file == IMM */ union { int32_t i; uint32_t u; diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp index 1ac215e6f40..819c1ef7b66 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp @@ -573,6 +573,23 @@ fs_visitor::generate_pull_constant_load(fs_inst *inst, struct brw_reg dst) } } +static uint32_t brw_file_from_reg(fs_reg *reg) +{ + switch (reg->file) { + case ARF: + return BRW_ARCHITECTURE_REGISTER_FILE; + case GRF: + return BRW_GENERAL_REGISTER_FILE; + case MRF: + return BRW_MESSAGE_REGISTER_FILE; + case IMM: + return BRW_IMMEDIATE_VALUE; + default: + assert(!"not reached"); + return BRW_GENERAL_REGISTER_FILE; + } +} + static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg) { @@ -583,9 +600,9 @@ brw_reg_from_fs_reg(fs_reg *reg) case ARF: case MRF: if (reg->smear == -1) { - brw_reg = brw_vec8_reg(reg->file, reg->reg, 0); + brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0); } else { - brw_reg = brw_vec1_reg(reg->file, reg->reg, reg->smear); + brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->reg, reg->smear); } brw_reg = retype(brw_reg, reg->type); if (reg->sechalf) |