Hi Iago, Am 22.08.2016 um 11:53 schrieb Iago Toral Quiroga: > This will make it more consistent with the FS implementation of the same > helper and will provide more flexibility that will come in handy, for > example, when we add a SIMD lowering pass in the vec4 backend. > --- > src/mesa/drivers/dri/i965/brw_ir_vec4.h | 47 > ++++++++++++++++++++++++++++++--- > 1 file changed, 43 insertions(+), 4 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h > b/src/mesa/drivers/dri/i965/brw_ir_vec4.h > index 81b6a13..058ffbb 100644 > --- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h > +++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h > @@ -60,13 +60,37 @@ retype(src_reg reg, enum brw_reg_type type) > return reg; > } > > +static inline void > +add_byte_offset(backend_reg *reg, unsigned delta) > +{ > + const unsigned suboffset = reg->subreg_offset + delta; > + reg->reg_offset += suboffset / REG_SIZE; > + reg->subreg_offset += suboffset % REG_SIZE; > + assert(reg->subreg_offset % 16 == 0); > +} > + > static inline src_reg > -offset(src_reg reg, unsigned delta) > +offset(src_reg reg, unsigned width, unsigned delta) > { > assert(delta == 0 || > (reg.file != ARF && reg.file != FIXED_GRF && reg.file != IMM)); > - reg.reg_offset += delta; Isnt that assert superfluous with the switch below, as you cover the second condition in the explicit cases? > + > + switch (reg.file) { > + case BAD_FILE: > + break; > + case MRF: > + case VGRF: > + case ATTR: > + case UNIFORM: { > + unsigned byte_offset = delta * width * type_sz(reg.type); > + add_byte_offset(®, byte_offset); > + break; > + } > + default: > + assert(delta = 0); delta == 0 ?
Same below. --Michael > + } > return reg; > + > } > > /** > @@ -130,12 +154,27 @@ retype(dst_reg reg, enum brw_reg_type type) > } > > static inline dst_reg > -offset(dst_reg reg, unsigned delta) > +offset(dst_reg reg, unsigned width, unsigned delta) > { > assert(delta == 0 || > (reg.file != ARF && reg.file != FIXED_GRF && reg.file != IMM)); > - reg.reg_offset += delta; > + > + switch (reg.file) { > + case BAD_FILE: > + break; > + case MRF: > + case VGRF: > + case ATTR: > + case UNIFORM: { > + unsigned byte_offset = delta * width * type_sz(reg.type); > + add_byte_offset(®, byte_offset); > + break; > + } > + default: > + assert(delta = 0); > + } > return reg; > + > } > > static inline dst_reg > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev