Module: Mesa Branch: master Commit: a3b8c5ed5bd591d4ae7d215f71f039d3b19200bb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3b8c5ed5bd591d4ae7d215f71f039d3b19200bb
Author: Eric Anholt <[email protected]> Date: Wed Nov 23 10:13:39 2011 -0800 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. --- src/mesa/drivers/dri/i965/brw_fs.h | 12 ++++++------ 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 de31644..cb93885 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 1ac215e..819c1ef 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) _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
