The same effect can be achieved using ::subreg_offset. Remove the less flexible alternative and define a convenience function to keep the fs_reg interface sane. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 9 ++------- src/mesa/drivers/dri/i965/brw_fs.h | 11 ++++++++++- src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 2 -- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 4 +--- 4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index e6e32fc..6b9c9b5 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1186,22 +1186,18 @@ fs_visitor::emit_samplepos_setup(ir_variable *ir) emit(MOV(int_sample_x, fs_reg(sample_pos_reg))); if (dispatch_width == 16) { - int_sample_x.sechalf = true; - fs_inst *inst = emit(MOV(int_sample_x, + fs_inst *inst = emit(MOV(half(int_sample_x, 1), fs_reg(suboffset(sample_pos_reg, 16)))); inst->force_sechalf = true; - int_sample_x.sechalf = false; } /* Compute gl_SamplePosition.x */ compute_sample_position(pos, int_sample_x); pos.reg_offset++; emit(MOV(int_sample_y, fs_reg(suboffset(sample_pos_reg, 1)))); if (dispatch_width == 16) { - int_sample_y.sechalf = true; - fs_inst *inst = emit(MOV(int_sample_y, + fs_inst *inst = emit(MOV(half(int_sample_y, 1), fs_reg(suboffset(sample_pos_reg, 17)))); inst->force_sechalf = true; - int_sample_y.sechalf = false; } /* Compute gl_SamplePosition.y */ compute_sample_position(pos, int_sample_y); @@ -2446,7 +2442,6 @@ fs_visitor::register_coalesce() new_src.abs = 1; } new_src.negate ^= scan_inst->src[i].negate; - new_src.sechalf = scan_inst->src[i].sechalf; new_src.subreg_offset += scan_inst->src[i].subreg_offset * new_src.stride; new_src.stride *= scan_inst->src[i].stride; diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index e36943c..2c36d9f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -86,7 +86,6 @@ public: bool negate; bool abs; - bool sechalf; int subreg_offset; /**< Offset in bytes from the start of the register. */ int stride; /**< Register region horizontal stride */ @@ -101,6 +100,16 @@ byte_offset(fs_reg reg, unsigned delta) return reg; } +/** + * Get either of the 8-component halves of a 16-component register. + */ +static inline fs_reg +half(const fs_reg ®, unsigned idx) +{ + assert(idx == 0 || (reg.file != HW_REG && reg.file != IMM)); + return byte_offset(reg, 8 * idx * reg.stride * type_sz(reg.type)); +} + static const fs_reg reg_undef; static const fs_reg reg_null_f(retype(brw_null_reg(), BRW_REGISTER_TYPE_F)); static const fs_reg reg_null_d(retype(brw_null_reg(), BRW_REGISTER_TYPE_D)); diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 3972fda..8d310a1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -996,8 +996,6 @@ brw_reg_from_fs_reg(fs_reg *reg) } brw_reg = retype(brw_reg, reg->type); - if (reg->sechalf) - brw_reg = sechalf(brw_reg); brw_reg = byte_offset(brw_reg, reg->subreg_offset); break; case IMM: diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 8a76094..5693dbc 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -2598,12 +2598,10 @@ fs_visitor::emit_color_write(int target, int index, int first_color_mrf) inst->saturate = c->key.clamp_fragment_color; pop_force_uncompressed(); - color.sechalf = true; inst = emit(MOV(fs_reg(MRF, first_color_mrf + index + 4, color.type), - color)); + half(color, 1))); inst->force_sechalf = true; inst->saturate = c->key.clamp_fragment_color; - color.sechalf = false; } } } -- 1.8.3.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev