<p dir="ltr"><br>
On Jun 24, 2015 4:29 AM, "Francisco Jerez" <<a href="mailto:currojerez@riseup.net">currojerez@riseup.net</a>> wrote:<br>
><br>
> Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> writes:<br>
><br>
> > On Tue, Jun 23, 2015 at 9:22 AM, Francisco Jerez <<a href="mailto:currojerez@riseup.net">currojerez@riseup.net</a>> wrote:<br>
> >> Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> writes:<br>
> >><br>
> >>> We want to move these into the builder so that they know the current<br>
> >>> builder's dispatch width. This will be needed by a later commit.<br>
> >><br>
> >> I very much like the idea of this series, but, why do you need to move<br>
> >> these register manipulators into the builder? The builder is an object<br>
> >> you can use to:<br>
> >> - Manipulate and query parameters affecting code generation.<br>
> >> - Create instructions into the program (::emit and friends).<br>
> >> - Allocate virtual registers from the program (::vgrf and friends).<br>
> >><br>
> >> offset() and half() logically perform an action on a given register<br>
> >> object (or rather, compute a function of a given register object), not<br>
> >> on a builder object, the builder is only required as an auxiliary<br>
> >> parameter -- Any reason you didn't just pass it as a third parameter?<br>
> ><br>
> > What's required as a third parameter is the current execution size. I<br>
> > could have passed that directly, but I figured that, especially for<br>
> > half(), it would get messed up. I could pass the builder in but I<br>
> > don't see a whole lot of difference between that and what I'm doing<br>
> > right now.<br>
><br>
> Assembly-wise there's no difference, but it seems inconsistent with both<br>
> the remaining register manipulators and remaining builder methods, and<br>
> IMHO it's kind of an anti-pattern to make something a method that<br>
> doesn't need access to any internal details of the object.<br>
><br>
> > As is, it's not entirely obvious whether you should call<br>
> > half(reg) on the half-width or full-width builder. I'm not 100% sure<br>
> > what to do about that.<br>
> ><br>
> Actually, does half() really need to know about the builder? AFAICT it<br>
> only needs it because of dispatch_width(), and before doing anything<br>
> useful with it it asserts that it's equal to 16, what points at the<br>
> parameter being redundant. By convention a "half" is a group of 8<br>
> channels (we may want to revise this convention when we implement SIMD32<br>
> -- E.g. make half a group of 16 channels and quarter a group of 8<br>
> channels), so 'half(reg)' could simply be implemented as<br>
> "horiz_offset(reg, 8 * i)" without any dependency on the builder. As<br>
> additional paranoia to catch half() being called on a non-16-aligned<br>
> register you could assert that either 'stride == 0' or 16 divides<br>
> '(REG_SIZE * reg_offset + subreg_offset) / (stride * type_size)' (why<br>
> don't we have a reg_offset already in bytes again?) -- That would also<br>
> catch cases in which the register and builder "widths" get out of sync,<br>
> e.g. if half is called in an already halved register but the builder<br>
> used happens to be of the correct exec_size.</p>
<p dir="ltr">OK, fine, we can pull half() back out. Should offset() stay in the builder? If not, where should it get its dispatch width.</p>
<p dir="ltr">> >> As offset() and half() don't require access to any private details of<br>
> >> the builder, that would actually improve encapsulation, and would avoid<br>
> >> the dubious overloading of fs_builder::half() with two methods with<br>
> >> completely different semantics.<br>
> ><br>
> > Yeah, I don't really like that either. I just couldn't come up with<br>
> > anything better at the time.<br>
> ><br>
> > Suggestions are very much welcome. But I would like to settle on<br>
> > whatever we do fairly quickly so as to limit the amount of<br>
> > refactoring.<br>
> > --Jason<br>
> ><br>
> >> Thanks.<br>
> >><br>
> >>> ---<br>
> >>> src/mesa/drivers/dri/i965/brw_fs.cpp | 52 ++++++----<br>
> >>> src/mesa/drivers/dri/i965/brw_fs_builder.h | 46 +++++++++<br>
> >>> src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 2 +-<br>
> >>> src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 60 +++++------<br>
> >>> src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 149 ++++++++++++++-------------<br>
> >>> src/mesa/drivers/dri/i965/brw_ir_fs.h | 51 ---------<br>
> >>> 6 files changed, 182 insertions(+), 178 deletions(-)<br>
> >>><br>
> >>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> >>> index 4f98d63..c13ac7d 100644<br>
> >>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> >>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> >>> @@ -267,7 +267,7 @@ fs_visitor::VARYING_PULL_CONSTANT_LOAD(const fs_builder &bld,<br>
> >>> inst->mlen = 1 + dispatch_width / 8;<br>
> >>> }<br>
> >>><br>
> >>> - bld.MOV(dst, offset(vec4_result, (const_offset & 3) * scale));<br>
> >>> + bld.MOV(dst, bld.offset(vec4_result, (const_offset & 3) * scale));<br>
> >>> }<br>
> >>><br>
> >>> /**<br>
> >>> @@ -361,7 +361,12 @@ fs_inst::is_copy_payload(const brw::simple_allocator &grf_alloc) const<br>
> >>> reg.width = this->src[i].width;<br>
> >>> if (!this->src[i].equals(reg))<br>
> >>> return false;<br>
> >>> - reg = ::offset(reg, 1);<br>
> >>> +<br>
> >>> + if (i < this->header_size) {<br>
> >>> + reg.reg_offset += 1;<br>
> >>> + } else {<br>
> >>> + reg.reg_offset += this->exec_size / 8;<br>
> >>> + }<br>
> >>> }<br>
> >>><br>
> >>> return true;<br>
> >>> @@ -963,7 +968,7 @@ fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer,<br>
> >>> } else {<br>
> >>> bld.ADD(wpos, this->pixel_x, fs_reg(0.5f));<br>
> >>> }<br>
> >>> - wpos = offset(wpos, 1);<br>
> >>> + wpos = bld.offset(wpos, 1);<br>
> >>><br>
> >>> /* gl_FragCoord.y */<br>
> >>> if (!flip && pixel_center_integer) {<br>
> >>> @@ -979,7 +984,7 @@ fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer,<br>
> >>><br>
> >>> bld.ADD(wpos, pixel_y, fs_reg(offset));<br>
> >>> }<br>
> >>> - wpos = offset(wpos, 1);<br>
> >>> + wpos = bld.offset(wpos, 1);<br>
> >>><br>
> >>> /* gl_FragCoord.z */<br>
> >>> if (devinfo->gen >= 6) {<br>
> >>> @@ -989,7 +994,7 @@ fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer,<br>
> >>> this->delta_xy[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC],<br>
> >>> interp_reg(VARYING_SLOT_POS, 2));<br>
> >>> }<br>
> >>> - wpos = offset(wpos, 1);<br>
> >>> + wpos = bld.offset(wpos, 1);<br>
> >>><br>
> >>> /* gl_FragCoord.w: Already set up in emit_interpolation */<br>
> >>> bld.MOV(wpos, this->wpos_w);<br>
> >>> @@ -1072,7 +1077,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,<br>
> >>> /* If there's no incoming setup data for this slot, don't<br>
> >>> * emit interpolation for it.<br>
> >>> */<br>
> >>> - attr = offset(attr, type->vector_elements);<br>
> >>> + attr = bld.offset(attr, type->vector_elements);<br>
> >>> location++;<br>
> >>> continue;<br>
> >>> }<br>
> >>> @@ -1087,7 +1092,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,<br>
> >>> interp = suboffset(interp, 3);<br>
> >>> interp.type = attr.type;<br>
> >>> bld.emit(FS_OPCODE_CINTERP, attr, fs_reg(interp));<br>
> >>> - attr = offset(attr, 1);<br>
> >>> + attr = bld.offset(attr, 1);<br>
> >>> }<br>
> >>> } else {<br>
> >>> /* Smooth/noperspective interpolation case. */<br>
> >>> @@ -1125,7 +1130,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,<br>
> >>> if (devinfo->gen < 6 && interpolation_mode == INTERP_QUALIFIER_SMOOTH) {<br>
> >>> bld.MUL(attr, attr, this->pixel_w);<br>
> >>> }<br>
> >>> - attr = offset(attr, 1);<br>
> >>> + attr = bld.offset(attr, 1);<br>
> >>> }<br>
> >>><br>
> >>> }<br>
> >>> @@ -1227,19 +1232,19 @@ fs_visitor::emit_samplepos_setup()<br>
> >>> if (dispatch_width == 8) {<br>
> >>> abld.MOV(int_sample_x, fs_reg(sample_pos_reg));<br>
> >>> } else {<br>
> >>> - abld.half(0).MOV(half(int_sample_x, 0), fs_reg(sample_pos_reg));<br>
> >>> - abld.half(1).MOV(half(int_sample_x, 1),<br>
> >>> + abld.half(0).MOV(abld.half(int_sample_x, 0), fs_reg(sample_pos_reg));<br>
> >>> + abld.half(1).MOV(abld.half(int_sample_x, 1),<br>
> >>> fs_reg(suboffset(sample_pos_reg, 16)));<br>
> >>> }<br>
> >>> /* Compute gl_SamplePosition.x */<br>
> >>> compute_sample_position(pos, int_sample_x);<br>
> >>> - pos = offset(pos, 1);<br>
> >>> + pos = abld.offset(pos, 1);<br>
> >>> if (dispatch_width == 8) {<br>
> >>> abld.MOV(int_sample_y, fs_reg(suboffset(sample_pos_reg, 1)));<br>
> >>> } else {<br>
> >>> - abld.half(0).MOV(half(int_sample_y, 0),<br>
> >>> + abld.half(0).MOV(abld.half(int_sample_y, 0),<br>
> >>> fs_reg(suboffset(sample_pos_reg, 1)));<br>
> >>> - abld.half(1).MOV(half(int_sample_y, 1),<br>
> >>> + abld.half(1).MOV(abld.half(int_sample_y, 1),<br>
> >>> fs_reg(suboffset(sample_pos_reg, 17)));<br>
> >>> }<br>
> >>> /* Compute gl_SamplePosition.y */<br>
> >>> @@ -3018,10 +3023,6 @@ fs_visitor::lower_load_payload()<br>
> >>><br>
> >>> assert(inst->dst.file == MRF || inst->dst.file == GRF);<br>
> >>> assert(inst->saturate == false);<br>
> >>> -<br>
> >>> - const fs_builder ibld = bld.group(inst->exec_size, inst->force_sechalf)<br>
> >>> - .exec_all(inst->force_writemask_all)<br>
> >>> - .at(block, inst);<br>
> >>> fs_reg dst = inst->dst;<br>
> >>><br>
> >>> /* Get rid of COMPR4. We'll add it back in if we need it */<br>
> >>> @@ -3029,17 +3030,23 @@ fs_visitor::lower_load_payload()<br>
> >>> dst.reg = dst.reg & ~BRW_MRF_COMPR4;<br>
> >>><br>
> >>> dst.width = 8;<br>
> >>> + const fs_builder hbld = bld.group(8, 0).exec_all().at(block, inst);<br>
> >>> +<br>
> >>> for (uint8_t i = 0; i < inst->header_size; i++) {<br>
> >>> if (inst->src[i].file != BAD_FILE) {<br>
> >>> fs_reg mov_dst = retype(dst, BRW_REGISTER_TYPE_UD);<br>
> >>> fs_reg mov_src = retype(inst->src[i], BRW_REGISTER_TYPE_UD);<br>
> >>> mov_src.width = 8;<br>
> >>> - ibld.exec_all().MOV(mov_dst, mov_src);<br>
> >>> + hbld.MOV(mov_dst, mov_src);<br>
> >>> }<br>
> >>> - dst = offset(dst, 1);<br>
> >>> + dst = hbld.offset(dst, 1);<br>
> >>> }<br>
> >>><br>
> >>> dst.width = inst->exec_size;<br>
> >>> + const fs_builder ibld = bld.group(inst->exec_size, inst->force_sechalf)<br>
> >>> + .exec_all(inst->force_writemask_all)<br>
> >>> + .at(block, inst);<br>
> >>> +<br>
> >>> if (inst->dst.file == MRF && (inst->dst.reg & BRW_MRF_COMPR4) &&<br>
> >>> inst->exec_size > 8) {<br>
> >>> /* In this case, the payload portion of the LOAD_PAYLOAD isn't<br>
> >>> @@ -3070,8 +3077,9 @@ fs_visitor::lower_load_payload()<br>
> >>> /* Platform doesn't have COMPR4. We have to fake it */<br>
> >>> fs_reg mov_dst = retype(dst, inst->src[i].type);<br>
> >>> mov_dst.width = 8;<br>
> >>> - ibld.half(0).MOV(mov_dst, half(inst->src[i], 0));<br>
> >>> - ibld.half(1).MOV(offset(mov_dst, 4), half(inst->src[i], 1));<br>
> >>> + ibld.half(0).MOV(mov_dst, ibld.half(inst->src[i], 0));<br>
> >>> + mov_dst.reg += 4;<br>
> >>> + ibld.half(1).MOV(mov_dst, ibld.half(inst->src[i], 1));<br>
> >>> }<br>
> >>> }<br>
> >>><br>
> >>> @@ -3096,7 +3104,7 @@ fs_visitor::lower_load_payload()<br>
> >>> for (uint8_t i = inst->header_size; i < inst->sources; i++) {<br>
> >>> if (inst->src[i].file != BAD_FILE)<br>
> >>> ibld.MOV(retype(dst, inst->src[i].type), inst->src[i]);<br>
> >>> - dst = offset(dst, 1);<br>
> >>> + dst = ibld.offset(dst, 1);<br>
> >>> }<br>
> >>><br>
> >>> inst->remove(block);<br>
> >>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_builder.h b/src/mesa/drivers/dri/i965/brw_fs_builder.h<br>
> >>> index 58ac598..594e252 100644<br>
> >>> --- a/src/mesa/drivers/dri/i965/brw_fs_builder.h<br>
> >>> +++ b/src/mesa/drivers/dri/i965/brw_fs_builder.h<br>
> >>> @@ -151,6 +151,52 @@ namespace brw {<br>
> >>> return _dispatch_width;<br>
> >>> }<br>
> >>><br>
> >>> + src_reg<br>
> >>> + offset(src_reg reg, unsigned delta) const<br>
> >>> + {<br>
> >>> + switch (reg.file) {<br>
> >>> + case BAD_FILE:<br>
> >>> + break;<br>
> >>> + case GRF:<br>
> >>> + case MRF:<br>
> >>> + case ATTR:<br>
> >>> + return byte_offset(reg,<br>
> >>> + delta * MAX2(reg.width * reg.stride, 1) *<br>
> >>> + type_sz(reg.type));<br>
> >>> + case UNIFORM:<br>
> >>> + reg.reg_offset += delta;<br>
> >>> + break;<br>
> >>> + default:<br>
> >>> + assert(delta == 0);<br>
> >>> + }<br>
> >>> + return reg;<br>
> >>> + }<br>
> >>> +<br>
> >>> + fs_reg<br>
> >>> + half(fs_reg reg, unsigned idx) const<br>
> >>> + {<br>
> >>> + assert(idx < 2);<br>
> >>> +<br>
> >>> + switch (reg.file) {<br>
> >>> + case BAD_FILE:<br>
> >>> + case UNIFORM:<br>
> >>> + case IMM:<br>
> >>> + return reg;<br>
> >>> +<br>
> >>> + case GRF:<br>
> >>> + case MRF:<br>
> >>> + assert(reg.width == 16);<br>
> >>> + reg.width = 8;<br>
> >>> + return horiz_offset(reg, 8 * idx);<br>
> >>> +<br>
> >>> + case ATTR:<br>
> >>> + case HW_REG:<br>
> >>> + default:<br>
> >>> + unreachable("Cannot take half of this register type");<br>
> >>> + }<br>
> >>> + return reg;<br>
> >>> + }<br>
> >>> +<br>
> >>> /**<br>
> >>> * Allocate a virtual register of natural vector size (one for this IR)<br>
> >>> * and SIMD width. \p n gives the amount of space to allocate in<br>
> >>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp<br>
> >>> index 70f0217..5ea66c5 100644<br>
> >>> --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp<br>
> >>> +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp<br>
> >>> @@ -205,7 +205,7 @@ create_copy_instr(const fs_builder &bld, fs_inst *inst, fs_reg src, bool negate)<br>
> >>> }<br>
> >>> for (int i = header_size; i < sources; i++) {<br>
> >>> payload[i] = src;<br>
> >>> - src = offset(src, 1);<br>
> >>> + src = ubld.offset(src, 1);<br>
> >>> }<br>
> >>> copy = ubld.LOAD_PAYLOAD(inst->dst, payload, sources, header_size);<br>
> >>> } else {<br>
> >>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> >>> index 59081ea..0ede634 100644<br>
> >>> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> >>> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> >>> @@ -76,7 +76,7 @@ fs_visitor::nir_setup_inputs(nir_shader *shader)<br>
> >>> {<br>
> >>> foreach_list_typed(nir_variable, var, node, &shader->inputs) {<br>
> >>> enum brw_reg_type type = brw_type_for_base_type(var->type);<br>
> >>> - fs_reg input = offset(nir_inputs, var->data.driver_location);<br>
> >>> + fs_reg input = bld.offset(nir_inputs, var->data.driver_location);<br>
> >>><br>
> >>> fs_reg reg;<br>
> >>> switch (stage) {<br>
> >>> @@ -95,8 +95,8 @@ fs_visitor::nir_setup_inputs(nir_shader *shader)<br>
> >>> unsigned array_length = var->type->is_array() ? var->type->length : 1;<br>
> >>> for (unsigned i = 0; i < array_length; i++) {<br>
> >>> for (unsigned j = 0; j < components; j++) {<br>
> >>> - bld.MOV(retype(offset(input, components * i + j), type),<br>
> >>> - offset(fs_reg(ATTR, var->data.location + i, type), j));<br>
> >>> + bld.MOV(retype(bld.offset(input, components * i + j), type),<br>
> >>> + bld.offset(fs_reg(ATTR, var->data.location + i, type), j));<br>
> >>> }<br>
> >>> }<br>
> >>> break;<br>
> >>> @@ -127,7 +127,7 @@ fs_visitor::nir_setup_outputs(nir_shader *shader)<br>
> >>> brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;<br>
> >>><br>
> >>> foreach_list_typed(nir_variable, var, node, &shader->outputs) {<br>
> >>> - fs_reg reg = offset(nir_outputs, var->data.driver_location);<br>
> >>> + fs_reg reg = bld.offset(nir_outputs, var->data.driver_location);<br>
> >>><br>
> >>> int vector_elements =<br>
> >>> var->type->is_array() ? var->type->fields.array->vector_elements<br>
> >>> @@ -136,7 +136,7 @@ fs_visitor::nir_setup_outputs(nir_shader *shader)<br>
> >>> if (stage == MESA_SHADER_VERTEX) {<br>
> >>> for (int i = 0; i < ALIGN(type_size(var->type), 4) / 4; i++) {<br>
> >>> int output = var->data.location + i;<br>
> >>> - this->outputs[output] = offset(reg, 4 * i);<br>
> >>> + this->outputs[output] = bld.offset(reg, 4 * i);<br>
> >>> this->output_components[output] = vector_elements;<br>
> >>> }<br>
> >>> } else if (var->data.index > 0) {<br>
> >>> @@ -162,7 +162,7 @@ fs_visitor::nir_setup_outputs(nir_shader *shader)<br>
> >>> /* General color output. */<br>
> >>> for (unsigned int i = 0; i < MAX2(1, var->type->length); i++) {<br>
> >>> int output = var->data.location - FRAG_RESULT_DATA0 + i;<br>
> >>> - this->outputs[output] = offset(reg, vector_elements * i);<br>
> >>> + this->outputs[output] = bld.offset(reg, vector_elements * i);<br>
> >>> this->output_components[output] = vector_elements;<br>
> >>> }<br>
> >>> }<br>
> >>> @@ -618,11 +618,11 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
> >>> continue;<br>
> >>><br>
> >>> if (instr->op == nir_op_imov || instr->op == nir_op_fmov) {<br>
> >>> - inst = bld.MOV(offset(temp, i),<br>
> >>> - offset(op[0], instr->src[0].swizzle[i]));<br>
> >>> + inst = bld.MOV(bld.offset(temp, i),<br>
> >>> + bld.offset(op[0], instr->src[0].swizzle[i]));<br>
> >>> } else {<br>
> >>> - inst = bld.MOV(offset(temp, i),<br>
> >>> - offset(op[i], instr->src[i].swizzle[0]));<br>
> >>> + inst = bld.MOV(bld.offset(temp, i),<br>
> >>> + bld.offset(op[i], instr->src[i].swizzle[0]));<br>
> >>> }<br>
> >>> inst->saturate = instr->dest.saturate;<br>
> >>> }<br>
> >>> @@ -636,7 +636,7 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
> >>> if (!(instr->dest.write_mask & (1 << i)))<br>
> >>> continue;<br>
> >>><br>
> >>> - bld.MOV(offset(result, i), offset(temp, i));<br>
> >>> + bld.MOV(bld.offset(result, i), bld.offset(temp, i));<br>
> >>> }<br>
> >>> }<br>
> >>> return;<br>
> >>> @@ -657,12 +657,12 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
> >>> assert(_mesa_bitcount(instr->dest.write_mask) == 1);<br>
> >>> channel = ffs(instr->dest.write_mask) - 1;<br>
> >>><br>
> >>> - result = offset(result, channel);<br>
> >>> + result = bld.offset(result, channel);<br>
> >>> }<br>
> >>><br>
> >>> for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {<br>
> >>> assert(nir_op_infos[instr->op].input_sizes[i] < 2);<br>
> >>> - op[i] = offset(op[i], instr->src[i].swizzle[channel]);<br>
> >>> + op[i] = bld.offset(op[i], instr->src[i].swizzle[channel]);<br>
> >>> }<br>
> >>><br>
> >>> switch (instr->op) {<br>
> >>> @@ -1156,7 +1156,7 @@ fs_reg_for_nir_reg(fs_visitor *v, nir_register *nir_reg,<br>
> >>> else<br>
> >>> reg = v->nir_locals[nir_reg->index];<br>
> >>><br>
> >>> - reg = offset(reg, base_offset * nir_reg->num_components);<br>
> >>> + reg = v->bld.offset(reg, base_offset * nir_reg->num_components);<br>
> >>> if (indirect) {<br>
> >>> int multiplier = nir_reg->num_components * (v->dispatch_width / 8);<br>
> >>><br>
> >>> @@ -1177,7 +1177,7 @@ fs_visitor::get_nir_src(nir_src src)<br>
> >>> fs_reg reg = bld.vgrf(BRW_REGISTER_TYPE_D, src.ssa->num_components);<br>
> >>><br>
> >>> for (unsigned i = 0; i < src.ssa->num_components; ++i)<br>
> >>> - bld.MOV(offset(reg, i), fs_reg(load->value.i[i]));<br>
> >>> + bld.MOV(bld.offset(reg, i), fs_reg(load->value.i[i]));<br>
> >>><br>
> >>> return reg;<br>
> >>> } else {<br>
> >>> @@ -1208,10 +1208,10 @@ fs_visitor::emit_percomp(const fs_builder &bld, const fs_inst &inst,<br>
> >>> continue;<br>
> >>><br>
> >>> fs_inst *new_inst = new(mem_ctx) fs_inst(inst);<br>
> >>> - new_inst->dst = offset(new_inst->dst, i);<br>
> >>> + new_inst->dst = bld.offset(new_inst->dst, i);<br>
> >>> for (unsigned j = 0; j < new_inst->sources; j++)<br>
> >>> if (new_inst->src[j].file == GRF)<br>
> >>> - new_inst->src[j] = offset(new_inst->src[j], i);<br>
> >>> + new_inst->src[j] = bld.offset(new_inst->src[j], i);<br>
> >>><br>
> >>> bld.emit(new_inst);<br>
> >>> }<br>
> >>> @@ -1322,7 +1322,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> >>> assert(sample_pos.file != BAD_FILE);<br>
> >>> dest.type = sample_pos.type;<br>
> >>> bld.MOV(dest, sample_pos);<br>
> >>> - bld.MOV(offset(dest, 1), offset(sample_pos, 1));<br>
> >>> + bld.MOV(bld.offset(dest, 1), bld.offset(sample_pos, 1));<br>
> >>> break;<br>
> >>> }<br>
> >>><br>
> >>> @@ -1349,13 +1349,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> >>> }<br>
> >>><br>
> >>> for (unsigned j = 0; j < instr->num_components; j++) {<br>
> >>> - fs_reg src = offset(retype(uniform_reg, dest.type), index);<br>
> >>> + fs_reg src = bld.offset(retype(uniform_reg, dest.type), index);<br>
> >>> if (has_indirect)<br>
> >>> src.reladdr = new(mem_ctx) fs_reg(get_nir_src(instr->src[0]));<br>
> >>> index++;<br>
> >>><br>
> >>> bld.MOV(dest, src);<br>
> >>> - dest = offset(dest, 1);<br>
> >>> + dest = bld.offset(dest, 1);<br>
> >>> }<br>
> >>> break;<br>
> >>> }<br>
> >>> @@ -1397,7 +1397,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> >>><br>
> >>> unsigned vec4_offset = instr->const_index[0] / 4;<br>
> >>> for (int i = 0; i < instr->num_components; i++)<br>
> >>> - VARYING_PULL_CONSTANT_LOAD(bld, offset(dest, i), surf_index,<br>
> >>> + VARYING_PULL_CONSTANT_LOAD(bld, bld.offset(dest, i), surf_index,<br>
> >>> base_offset, vec4_offset + i);<br>
> >>> } else {<br>
> >>> fs_reg packed_consts = vgrf(glsl_type::float_type);<br>
> >>> @@ -1416,7 +1416,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> >>> assert(packed_consts.subreg_offset < 32);<br>
> >>><br>
> >>> bld.MOV(dest, packed_consts);<br>
> >>> - dest = offset(dest, 1);<br>
> >>> + dest = bld.offset(dest, 1);<br>
> >>> }<br>
> >>> }<br>
> >>> break;<br>
> >>> @@ -1428,14 +1428,14 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> >>> case nir_intrinsic_load_input: {<br>
> >>> unsigned index = 0;<br>
> >>> for (unsigned j = 0; j < instr->num_components; j++) {<br>
> >>> - fs_reg src = offset(retype(nir_inputs, dest.type),<br>
> >>> + fs_reg src = bld.offset(retype(nir_inputs, dest.type),<br>
> >>> instr->const_index[0] + index);<br>
> >>> if (has_indirect)<br>
> >>> src.reladdr = new(mem_ctx) fs_reg(get_nir_src(instr->src[0]));<br>
> >>> index++;<br>
> >>><br>
> >>> bld.MOV(dest, src);<br>
> >>> - dest = offset(dest, 1);<br>
> >>> + dest = bld.offset(dest, 1);<br>
> >>> }<br>
> >>> break;<br>
> >>> }<br>
> >>> @@ -1508,7 +1508,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> >>> BRW_REGISTER_TYPE_F);<br>
> >>> for (int i = 0; i < 2; i++) {<br>
> >>> fs_reg temp = vgrf(glsl_type::float_type);<br>
> >>> - bld.MUL(temp, offset(offset_src, i), fs_reg(16.0f));<br>
> >>> + bld.MUL(temp, bld.offset(offset_src, i), fs_reg(16.0f));<br>
> >>> fs_reg itemp = vgrf(glsl_type::int_type);<br>
> >>> bld.MOV(itemp, temp); /* float to int */<br>
> >>><br>
> >>> @@ -1528,7 +1528,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> >>> * FRAGMENT_INTERPOLATION_OFFSET_BITS"<br>
> >>> */<br>
> >>> set_condmod(BRW_CONDITIONAL_L,<br>
> >>> - bld.SEL(offset(src, i), itemp, fs_reg(7)));<br>
> >>> + bld.SEL(bld.offset(src, i), itemp, fs_reg(7)));<br>
> >>> }<br>
> >>><br>
> >>> mlen = 2;<br>
> >>> @@ -1552,7 +1552,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> >>> src.type = dest.type;<br>
> >>><br>
> >>> bld.emit(FS_OPCODE_LINTERP, dest, dst_xy, src);<br>
> >>> - dest = offset(dest, 1);<br>
> >>> + dest = bld.offset(dest, 1);<br>
> >>> }<br>
> >>> break;<br>
> >>> }<br>
> >>> @@ -1564,13 +1564,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> >>> fs_reg src = get_nir_src(instr->src[0]);<br>
> >>> unsigned index = 0;<br>
> >>> for (unsigned j = 0; j < instr->num_components; j++) {<br>
> >>> - fs_reg new_dest = offset(retype(nir_outputs, src.type),<br>
> >>> - instr->const_index[0] + index);<br>
> >>> + fs_reg new_dest = bld.offset(retype(nir_outputs, src.type),<br>
> >>> + instr->const_index[0] + index);<br>
> >>> if (has_indirect)<br>
> >>> src.reladdr = new(mem_ctx) fs_reg(get_nir_src(instr->src[1]));<br>
> >>> index++;<br>
> >>> bld.MOV(new_dest, src);<br>
> >>> - src = offset(src, 1);<br>
> >>> + src = bld.offset(src, 1);<br>
> >>> }<br>
> >>> break;<br>
> >>> }<br>
> >>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> >>> index 8a43ec8..68cd454 100644<br>
> >>> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> >>> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> >>> @@ -95,7 +95,7 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst,<br>
> >>> if (shadow_c.file != BAD_FILE) {<br>
> >>> for (int i = 0; i < coord_components; i++) {<br>
> >>> bld.MOV(fs_reg(MRF, base_mrf + mlen + i), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> }<br>
> >>><br>
> >>> /* gen4's SIMD8 sampler always has the slots for u,v,r present.<br>
> >>> @@ -124,7 +124,7 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst,<br>
> >>> } else if (op == ir_tex) {<br>
> >>> for (int i = 0; i < coord_components; i++) {<br>
> >>> bld.MOV(fs_reg(MRF, base_mrf + mlen + i), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> }<br>
> >>> /* zero the others. */<br>
> >>> for (int i = coord_components; i<3; i++) {<br>
> >>> @@ -137,7 +137,7 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst,<br>
> >>><br>
> >>> for (int i = 0; i < coord_components; i++) {<br>
> >>> bld.MOV(fs_reg(MRF, base_mrf + mlen + i), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> }<br>
> >>> /* the slots for u and v are always present, but r is optional */<br>
> >>> mlen += MAX2(coord_components, 2);<br>
> >>> @@ -158,13 +158,13 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst,<br>
> >>> */<br>
> >>> for (int i = 0; i < grad_components; i++) {<br>
> >>> bld.MOV(fs_reg(MRF, base_mrf + mlen), dPdx);<br>
> >>> - dPdx = offset(dPdx, 1);<br>
> >>> + dPdx = bld.offset(dPdx, 1);<br>
> >>> }<br>
> >>> mlen += MAX2(grad_components, 2);<br>
> >>><br>
> >>> for (int i = 0; i < grad_components; i++) {<br>
> >>> bld.MOV(fs_reg(MRF, base_mrf + mlen), dPdy);<br>
> >>> - dPdy = offset(dPdy, 1);<br>
> >>> + dPdy = bld.offset(dPdy, 1);<br>
> >>> }<br>
> >>> mlen += MAX2(grad_components, 2);<br>
> >>> } else if (op == ir_txs) {<br>
> >>> @@ -182,7 +182,7 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst,<br>
> >>> for (int i = 0; i < coord_components; i++) {<br>
> >>> bld.MOV(fs_reg(MRF, base_mrf + mlen + i * 2, coordinate.type),<br>
> >>> coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> }<br>
> >>><br>
> >>> /* Initialize the rest of u/v/r with 0.0. Empirically, this seems to<br>
> >>> @@ -232,8 +232,8 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst,<br>
> >>> if (simd16) {<br>
> >>> for (int i = 0; i < 4; i++) {<br>
> >>> bld.MOV(orig_dst, dst);<br>
> >>> - orig_dst = offset(orig_dst, 1);<br>
> >>> - dst = offset(dst, 2);<br>
> >>> + orig_dst = bld.offset(orig_dst, 1);<br>
> >>> + dst = bld.offset(dst, 2);<br>
> >>> }<br>
> >>> }<br>
> >>><br>
> >>> @@ -257,30 +257,30 @@ fs_visitor::emit_texture_gen4_simd16(ir_texture_opcode op, fs_reg dst,<br>
> >>><br>
> >>> /* Copy the coordinates. */<br>
> >>> for (int i = 0; i < vector_elements; i++) {<br>
> >>> - bld.MOV(retype(offset(message, i), coordinate.type), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + bld.MOV(retype(bld.offset(message, i), coordinate.type), coordinate);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> }<br>
> >>><br>
> >>> - fs_reg msg_end = offset(message, vector_elements);<br>
> >>> + fs_reg msg_end = bld.offset(message, vector_elements);<br>
> >>><br>
> >>> /* Messages other than sample and ld require all three components */<br>
> >>> if (has_lod || shadow_c.file != BAD_FILE) {<br>
> >>> for (int i = vector_elements; i < 3; i++) {<br>
> >>> - bld.MOV(offset(message, i), fs_reg(0.0f));<br>
> >>> + bld.MOV(bld.offset(message, i), fs_reg(0.0f));<br>
> >>> }<br>
> >>> }<br>
> >>><br>
> >>> if (has_lod) {<br>
> >>> - fs_reg msg_lod = retype(offset(message, 3), op == ir_txf ?<br>
> >>> + fs_reg msg_lod = retype(bld.offset(message, 3), op == ir_txf ?<br>
> >>> BRW_REGISTER_TYPE_UD : BRW_REGISTER_TYPE_F);<br>
> >>> bld.MOV(msg_lod, lod);<br>
> >>> - msg_end = offset(msg_lod, 1);<br>
> >>> + msg_end = bld.offset(msg_lod, 1);<br>
> >>> }<br>
> >>><br>
> >>> if (shadow_c.file != BAD_FILE) {<br>
> >>> - fs_reg msg_ref = offset(message, 3 + has_lod);<br>
> >>> + fs_reg msg_ref = bld.offset(message, 3 + has_lod);<br>
> >>> bld.MOV(msg_ref, shadow_c);<br>
> >>> - msg_end = offset(msg_ref, 1);<br>
> >>> + msg_end = bld.offset(msg_ref, 1);<br>
> >>> }<br>
> >>><br>
> >>> enum opcode opcode;<br>
> >>> @@ -334,16 +334,16 @@ fs_visitor::emit_texture_gen5(ir_texture_opcode op, fs_reg dst,<br>
> >>> }<br>
> >>><br>
> >>> for (int i = 0; i < vector_elements; i++) {<br>
> >>> - bld.MOV(retype(offset(msg_coords, i), coordinate.type), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + bld.MOV(retype(bld.offset(msg_coords, i), coordinate.type), coordinate);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> }<br>
> >>> - fs_reg msg_end = offset(msg_coords, vector_elements);<br>
> >>> - fs_reg msg_lod = offset(msg_coords, 4);<br>
> >>> + fs_reg msg_end = bld.offset(msg_coords, vector_elements);<br>
> >>> + fs_reg msg_lod = bld.offset(msg_coords, 4);<br>
> >>><br>
> >>> if (shadow_c.file != BAD_FILE) {<br>
> >>> fs_reg msg_shadow = msg_lod;<br>
> >>> bld.MOV(msg_shadow, shadow_c);<br>
> >>> - msg_lod = offset(msg_shadow, 1);<br>
> >>> + msg_lod = bld.offset(msg_shadow, 1);<br>
> >>> msg_end = msg_lod;<br>
> >>> }<br>
> >>><br>
> >>> @@ -354,13 +354,13 @@ fs_visitor::emit_texture_gen5(ir_texture_opcode op, fs_reg dst,<br>
> >>> break;<br>
> >>> case ir_txb:<br>
> >>> bld.MOV(msg_lod, lod);<br>
> >>> - msg_end = offset(msg_lod, 1);<br>
> >>> + msg_end = bld.offset(msg_lod, 1);<br>
> >>><br>
> >>> opcode = FS_OPCODE_TXB;<br>
> >>> break;<br>
> >>> case ir_txl:<br>
> >>> bld.MOV(msg_lod, lod);<br>
> >>> - msg_end = offset(msg_lod, 1);<br>
> >>> + msg_end = bld.offset(msg_lod, 1);<br>
> >>><br>
> >>> opcode = SHADER_OPCODE_TXL;<br>
> >>> break;<br>
> >>> @@ -377,12 +377,12 @@ fs_visitor::emit_texture_gen5(ir_texture_opcode op, fs_reg dst,<br>
> >>> msg_end = msg_lod;<br>
> >>> for (int i = 0; i < grad_components; i++) {<br>
> >>> bld.MOV(msg_end, lod);<br>
> >>> - lod = offset(lod, 1);<br>
> >>> - msg_end = offset(msg_end, 1);<br>
> >>> + lod = bld.offset(lod, 1);<br>
> >>> + msg_end = bld.offset(msg_end, 1);<br>
> >>><br>
> >>> bld.MOV(msg_end, lod2);<br>
> >>> - lod2 = offset(lod2, 1);<br>
> >>> - msg_end = offset(msg_end, 1);<br>
> >>> + lod2 = bld.offset(lod2, 1);<br>
> >>> + msg_end = bld.offset(msg_end, 1);<br>
> >>> }<br>
> >>><br>
> >>> opcode = SHADER_OPCODE_TXD;<br>
> >>> @@ -391,31 +391,31 @@ fs_visitor::emit_texture_gen5(ir_texture_opcode op, fs_reg dst,<br>
> >>> case ir_txs:<br>
> >>> msg_lod = retype(msg_end, BRW_REGISTER_TYPE_UD);<br>
> >>> bld.MOV(msg_lod, lod);<br>
> >>> - msg_end = offset(msg_lod, 1);<br>
> >>> + msg_end = bld.offset(msg_lod, 1);<br>
> >>><br>
> >>> opcode = SHADER_OPCODE_TXS;<br>
> >>> break;<br>
> >>> case ir_query_levels:<br>
> >>> msg_lod = msg_end;<br>
> >>> bld.MOV(retype(msg_lod, BRW_REGISTER_TYPE_UD), fs_reg(0u));<br>
> >>> - msg_end = offset(msg_lod, 1);<br>
> >>> + msg_end = bld.offset(msg_lod, 1);<br>
> >>><br>
> >>> opcode = SHADER_OPCODE_TXS;<br>
> >>> break;<br>
> >>> case ir_txf:<br>
> >>> - msg_lod = offset(msg_coords, 3);<br>
> >>> + msg_lod = bld.offset(msg_coords, 3);<br>
> >>> bld.MOV(retype(msg_lod, BRW_REGISTER_TYPE_UD), lod);<br>
> >>> - msg_end = offset(msg_lod, 1);<br>
> >>> + msg_end = bld.offset(msg_lod, 1);<br>
> >>><br>
> >>> opcode = SHADER_OPCODE_TXF;<br>
> >>> break;<br>
> >>> case ir_txf_ms:<br>
> >>> - msg_lod = offset(msg_coords, 3);<br>
> >>> + msg_lod = bld.offset(msg_coords, 3);<br>
> >>> /* lod */<br>
> >>> bld.MOV(retype(msg_lod, BRW_REGISTER_TYPE_UD), fs_reg(0u));<br>
> >>> /* sample index */<br>
> >>> - bld.MOV(retype(offset(msg_lod, 1), BRW_REGISTER_TYPE_UD), sample_index);<br>
> >>> - msg_end = offset(msg_lod, 2);<br>
> >>> + bld.MOV(retype(bld.offset(msg_lod, 1), BRW_REGISTER_TYPE_UD), sample_index);<br>
> >>> + msg_end = bld.offset(msg_lod, 2);<br>
> >>><br>
> >>> opcode = SHADER_OPCODE_TXF_CMS;<br>
> >>> break;<br>
> >>> @@ -525,7 +525,7 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst,<br>
> >>> */<br>
> >>> for (int i = 0; i < coord_components; i++) {<br>
> >>> bld.MOV(sources[length], coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> length++;<br>
> >>><br>
> >>> /* For cube map array, the coordinate is (u,v,r,ai) but there are<br>
> >>> @@ -533,11 +533,11 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst,<br>
> >>> */<br>
> >>> if (i < grad_components) {<br>
> >>> bld.MOV(sources[length], lod);<br>
> >>> - lod = offset(lod, 1);<br>
> >>> + lod = bld.offset(lod, 1);<br>
> >>> length++;<br>
> >>><br>
> >>> bld.MOV(sources[length], lod2);<br>
> >>> - lod2 = offset(lod2, 1);<br>
> >>> + lod2 = bld.offset(lod2, 1);<br>
> >>> length++;<br>
> >>> }<br>
> >>> }<br>
> >>> @@ -559,13 +559,13 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst,<br>
> >>> */<br>
> >>><br>
> >>> bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> length++;<br>
> >>><br>
> >>> if (devinfo->gen >= 9) {<br>
> >>> if (coord_components >= 2) {<br>
> >>> bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> }<br>
> >>> length++;<br>
> >>> }<br>
> >>> @@ -575,7 +575,7 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst,<br>
> >>><br>
> >>> for (int i = devinfo->gen >= 9 ? 2 : 1; i < coord_components; i++) {<br>
> >>> bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> length++;<br>
> >>> }<br>
> >>><br>
> >>> @@ -594,7 +594,7 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst,<br>
> >>> */<br>
> >>> for (int i = 0; i < coord_components; i++) {<br>
> >>> bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> length++;<br>
> >>> }<br>
> >>><br>
> >>> @@ -608,19 +608,19 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst,<br>
> >>> /* More crazy intermixing */<br>
> >>> for (int i = 0; i < 2; i++) { /* u, v */<br>
> >>> bld.MOV(sources[length], coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> length++;<br>
> >>> }<br>
> >>><br>
> >>> for (int i = 0; i < 2; i++) { /* offu, offv */<br>
> >>> bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), offset_value);<br>
> >>> - offset_value = offset(offset_value, 1);<br>
> >>> + offset_value = bld.offset(offset_value, 1);<br>
> >>> length++;<br>
> >>> }<br>
> >>><br>
> >>> if (coord_components == 3) { /* r if present */<br>
> >>> bld.MOV(sources[length], coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> length++;<br>
> >>> }<br>
> >>><br>
> >>> @@ -633,7 +633,7 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst,<br>
> >>> if (!coordinate_done) {<br>
> >>> for (int i = 0; i < coord_components; i++) {<br>
> >>> bld.MOV(sources[length], coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> length++;<br>
> >>> }<br>
> >>> }<br>
> >>> @@ -746,8 +746,8 @@ fs_visitor::rescale_texcoord(fs_reg coordinate, int coord_components,<br>
> >>> coordinate = dst;<br>
> >>><br>
> >>> bld.MUL(dst, src, scale_x);<br>
> >>> - dst = offset(dst, 1);<br>
> >>> - src = offset(src, 1);<br>
> >>> + dst = bld.offset(dst, 1);<br>
> >>> + src = bld.offset(src, 1);<br>
> >>> bld.MUL(dst, src, scale_y);<br>
> >>> } else if (is_rect) {<br>
> >>> /* On gen6+, the sampler handles the rectangle coordinates<br>
> >>> @@ -760,7 +760,7 @@ fs_visitor::rescale_texcoord(fs_reg coordinate, int coord_components,<br>
> >>> for (int i = 0; i < 2; i++) {<br>
> >>> if (key_tex->gl_clamp_mask[i] & (1 << sampler)) {<br>
> >>> fs_reg chan = coordinate;<br>
> >>> - chan = offset(chan, i);<br>
> >>> + chan = bld.offset(chan, i);<br>
> >>><br>
> >>> set_condmod(BRW_CONDITIONAL_GE,<br>
> >>> bld.emit(BRW_OPCODE_SEL, chan, chan, fs_reg(0.0f)));<br>
> >>> @@ -785,7 +785,7 @@ fs_visitor::rescale_texcoord(fs_reg coordinate, int coord_components,<br>
> >>> for (int i = 0; i < MIN2(coord_components, 3); i++) {<br>
> >>> if (key_tex->gl_clamp_mask[i] & (1 << sampler)) {<br>
> >>> fs_reg chan = coordinate;<br>
> >>> - chan = offset(chan, i);<br>
> >>> + chan = bld.offset(chan, i);<br>
> >>> set_saturate(true, bld.MOV(chan, chan));<br>
> >>> }<br>
> >>> }<br>
> >>> @@ -807,7 +807,7 @@ fs_visitor::emit_mcs_fetch(fs_reg coordinate, int components, fs_reg sampler)<br>
> >>> for (int i = 0; i < components; i++) {<br>
> >>> sources[i] = vgrf(glsl_type::float_type);<br>
> >>> bld.MOV(retype(sources[i], BRW_REGISTER_TYPE_D), coordinate);<br>
> >>> - coordinate = offset(coordinate, 1);<br>
> >>> + coordinate = bld.offset(coordinate, 1);<br>
> >>> }<br>
> >>><br>
> >>> bld.LOAD_PAYLOAD(payload, sources, components, 0);<br>
> >>> @@ -853,7 +853,7 @@ fs_visitor::emit_texture(ir_texture_opcode op,<br>
> >>><br>
> >>> for (int i=0; i<4; i++) {<br>
> >>> bld.MOV(res, fs_reg(swiz == SWIZZLE_ZERO ? 0.0f : 1.0f));<br>
> >>> - res = offset(res, 1);<br>
> >>> + res = bld.offset(res, 1);<br>
> >>> }<br>
> >>> return;<br>
> >>> }<br>
> >>> @@ -907,7 +907,7 @@ fs_visitor::emit_texture(ir_texture_opcode op,<br>
> >>><br>
> >>> /* fixup #layers for cube map arrays */<br>
> >>> if (op == ir_txs && is_cube_array) {<br>
> >>> - fs_reg depth = offset(dst, 2);<br>
> >>> + fs_reg depth = bld.offset(dst, 2);<br>
> >>> fs_reg fixed_depth = vgrf(glsl_type::int_type);<br>
> >>> bld.emit(SHADER_OPCODE_INT_QUOTIENT, fixed_depth, depth, fs_reg(6));<br>
> >>><br>
> >>> @@ -917,7 +917,7 @@ fs_visitor::emit_texture(ir_texture_opcode op,<br>
> >>> if (i == 2) {<br>
> >>> fixed_payload[i] = fixed_depth;<br>
> >>> } else {<br>
> >>> - fixed_payload[i] = offset(dst, i);<br>
> >>> + fixed_payload[i] = bld.offset(dst, i);<br>
> >>> }<br>
> >>> }<br>
> >>> bld.LOAD_PAYLOAD(dst, fixed_payload, components, 0);<br>
> >>> @@ -952,7 +952,7 @@ fs_visitor::emit_gen6_gather_wa(uint8_t wa, fs_reg dst)<br>
> >>> bld.ASR(dst, dst, fs_reg(32 - width));<br>
> >>> }<br>
> >>><br>
> >>> - dst = offset(dst, 1);<br>
> >>> + dst = bld.offset(dst, 1);<br>
> >>> }<br>
> >>> }<br>
> >>><br>
> >>> @@ -989,7 +989,7 @@ fs_visitor::swizzle_result(ir_texture_opcode op, int dest_components,<br>
> >>> {<br>
> >>> if (op == ir_query_levels) {<br>
> >>> /* # levels is in .w */<br>
> >>> - this->result = offset(orig_val, 3);<br>
> >>> + this->result = bld.offset(orig_val, 3);<br>
> >>> return;<br>
> >>> }<br>
> >>><br>
> >>> @@ -1010,15 +1010,15 @@ fs_visitor::swizzle_result(ir_texture_opcode op, int dest_components,<br>
> >>> for (int i = 0; i < 4; i++) {<br>
> >>> int swiz = GET_SWZ(key_tex->swizzles[sampler], i);<br>
> >>> fs_reg l = swizzled_result;<br>
> >>> - l = offset(l, i);<br>
> >>> + l = bld.offset(l, i);<br>
> >>><br>
> >>> if (swiz == SWIZZLE_ZERO) {<br>
> >>> bld.MOV(l, fs_reg(0.0f));<br>
> >>> } else if (swiz == SWIZZLE_ONE) {<br>
> >>> bld.MOV(l, fs_reg(1.0f));<br>
> >>> } else {<br>
> >>> - bld.MOV(l, offset(orig_val,<br>
> >>> - GET_SWZ(key_tex->swizzles[sampler], i)));<br>
> >>> + bld.MOV(l, bld.offset(orig_val,<br>
> >>> + GET_SWZ(key_tex->swizzles[sampler], i)));<br>
> >>> }<br>
> >>> }<br>
> >>> this->result = swizzled_result;<br>
> >>> @@ -1315,14 +1315,14 @@ fs_visitor::emit_interpolation_setup_gen4()<br>
> >>><br>
> >>> if (devinfo->has_pln && dispatch_width == 16) {<br>
> >>> for (unsigned i = 0; i < 2; i++) {<br>
> >>> - abld.half(i).ADD(half(offset(delta_xy, i), 0),<br>
> >>> - half(this->pixel_x, i), xstart);<br>
> >>> - abld.half(i).ADD(half(offset(delta_xy, i), 1),<br>
> >>> - half(this->pixel_y, i), ystart);<br>
> >>> + abld.half(i).ADD(abld.half(abld.offset(delta_xy, i), 0),<br>
> >>> + abld.half(this->pixel_x, i), xstart);<br>
> >>> + abld.half(i).ADD(abld.half(abld.offset(delta_xy, i), 1),<br>
> >>> + abld.half(this->pixel_y, i), ystart);<br>
> >>> }<br>
> >>> } else {<br>
> >>> - abld.ADD(offset(delta_xy, 0), this->pixel_x, xstart);<br>
> >>> - abld.ADD(offset(delta_xy, 1), this->pixel_y, ystart);<br>
> >>> + abld.ADD(abld.offset(delta_xy, 0), this->pixel_x, xstart);<br>
> >>> + abld.ADD(abld.offset(delta_xy, 1), this->pixel_y, ystart);<br>
> >>> }<br>
> >>><br>
> >>> abld = bld.annotate("compute pos.w and 1/pos.w");<br>
> >>> @@ -1419,7 +1419,7 @@ fs_visitor::setup_color_payload(fs_reg *dst, fs_reg color, unsigned components,<br>
> >>> fs_reg tmp = vgrf(glsl_type::vec4_type);<br>
> >>> assert(color.type == BRW_REGISTER_TYPE_F);<br>
> >>> for (unsigned i = 0; i < components; i++) {<br>
> >>> - inst = bld.MOV(offset(tmp, i), offset(color, i));<br>
> >>> + inst = bld.MOV(bld.offset(tmp, i), bld.offset(color, i));<br>
> >>> inst->saturate = true;<br>
> >>> }<br>
> >>> color = tmp;<br>
> >>> @@ -1428,10 +1428,10 @@ fs_visitor::setup_color_payload(fs_reg *dst, fs_reg color, unsigned components,<br>
> >>> if (exec_size < dispatch_width) {<br>
> >>> unsigned half_idx = use_2nd_half ? 1 : 0;<br>
> >>> for (unsigned i = 0; i < components; i++)<br>
> >>> - dst[i] = half(offset(color, i), half_idx);<br>
> >>> + dst[i] = bld.half(bld.offset(color, i), half_idx);<br>
> >>> } else {<br>
> >>> for (unsigned i = 0; i < components; i++)<br>
> >>> - dst[i] = offset(color, i);<br>
> >>> + dst[i] = bld.offset(color, i);<br>
> >>> }<br>
> >>> }<br>
> >>><br>
> >>> @@ -1479,7 +1479,7 @@ fs_visitor::emit_alpha_test()<br>
> >>> BRW_CONDITIONAL_NEQ);<br>
> >>> } else {<br>
> >>> /* RT0 alpha */<br>
> >>> - fs_reg color = offset(outputs[0], 3);<br>
> >>> + fs_reg color = bld.offset(outputs[0], 3);<br>
> >>><br>
> >>> /* f0.1 &= func(color, ref) */<br>
> >>> cmp = abld.CMP(bld.null_reg_f(), color, fs_reg(key->alpha_test_ref),<br>
> >>> @@ -1556,7 +1556,8 @@ fs_visitor::emit_single_fb_write(const fs_builder &bld,<br>
> >>> * alpha-testing, alpha-to-coverage, and so on.<br>
> >>> */<br>
> >>> if (this->outputs[0].file != BAD_FILE)<br>
> >>> - setup_color_payload(&sources[length + 3], offset(this->outputs[0], 3),<br>
> >>> + setup_color_payload(&sources[length + 3],<br>
> >>> + bld.offset(this->outputs[0], 3),<br>
> >>> 1, exec_size, false);<br>
> >>> length += 4;<br>
> >>> } else if (color1.file == BAD_FILE) {<br>
> >>> @@ -1591,7 +1592,7 @@ fs_visitor::emit_single_fb_write(const fs_builder &bld,<br>
> >>> /* Hand over gl_FragDepth. */<br>
> >>> assert(this->frag_depth.file != BAD_FILE);<br>
> >>> if (exec_size < dispatch_width) {<br>
> >>> - sources[length] = half(this->frag_depth, use_2nd_half);<br>
> >>> + sources[length] = bld.half(this->frag_depth, use_2nd_half);<br>
> >>> } else {<br>
> >>> sources[length] = this->frag_depth;<br>
> >>> }<br>
> >>> @@ -1692,7 +1693,7 @@ fs_visitor::emit_fb_writes()<br>
> >>><br>
> >>> fs_reg src0_alpha;<br>
> >>> if (devinfo->gen >= 6 && key->replicate_alpha && target != 0)<br>
> >>> - src0_alpha = offset(outputs[0], 3);<br>
> >>> + src0_alpha = bld.offset(outputs[0], 3);<br>
> >>><br>
> >>> inst = emit_single_fb_write(abld, this->outputs[target], reg_undef,<br>
> >>> src0_alpha,<br>
> >>> @@ -1776,7 +1777,7 @@ void fs_visitor::compute_clip_distance()<br>
> >>> abld.MUL(output, outputs[clip_vertex], u);<br>
> >>> for (int j = 1; j < 4; j++) {<br>
> >>> u.reg = userplane[i].reg + j;<br>
> >>> - abld.MAD(output, output, offset(outputs[clip_vertex], j), u);<br>
> >>> + abld.MAD(output, output, bld.offset(outputs[clip_vertex], j), u);<br>
> >>> }<br>
> >>> }<br>
> >>> }<br>
> >>> @@ -1890,13 +1891,13 @@ fs_visitor::emit_urb_writes()<br>
> >>> */<br>
> >>> for (int i = 0; i < 4; i++) {<br>
> >>> reg = fs_reg(GRF, alloc.allocate(1), outputs[varying].type);<br>
> >>> - src = offset(this->outputs[varying], i);<br>
> >>> + src = bld.offset(this->outputs[varying], i);<br>
> >>> set_saturate(true, bld.MOV(reg, src));<br>
> >>> sources[length++] = reg;<br>
> >>> }<br>
> >>> } else {<br>
> >>> for (int i = 0; i < 4; i++)<br>
> >>> - sources[length++] = offset(this->outputs[varying], i);<br>
> >>> + sources[length++] = bld.offset(this->outputs[varying], i);<br>
> >>> }<br>
> >>> break;<br>
> >>> }<br>
> >>> diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h<br>
> >>> index 96dc20d..10033ca 100644<br>
> >>> --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h<br>
> >>> +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h<br>
> >>> @@ -129,27 +129,6 @@ horiz_offset(fs_reg reg, unsigned delta)<br>
> >>> }<br>
> >>><br>
> >>> static inline fs_reg<br>
> >>> -offset(fs_reg reg, unsigned delta)<br>
> >>> -{<br>
> >>> - switch (reg.file) {<br>
> >>> - case BAD_FILE:<br>
> >>> - break;<br>
> >>> - case GRF:<br>
> >>> - case MRF:<br>
> >>> - case ATTR:<br>
> >>> - return byte_offset(reg,<br>
> >>> - delta * MAX2(reg.width * reg.stride, 1) *<br>
> >>> - type_sz(reg.type));<br>
> >>> - case UNIFORM:<br>
> >>> - reg.reg_offset += delta;<br>
> >>> - break;<br>
> >>> - default:<br>
> >>> - assert(delta == 0);<br>
> >>> - }<br>
> >>> - return reg;<br>
> >>> -}<br>
> >>> -<br>
> >>> -static inline fs_reg<br>
> >>> component(fs_reg reg, unsigned idx)<br>
> >>> {<br>
> >>> assert(reg.subreg_offset == 0);<br>
> >>> @@ -167,36 +146,6 @@ is_uniform(const fs_reg ®)<br>
> >>> (!reg.reladdr || is_uniform(*reg.reladdr));<br>
> >>> }<br>
> >>><br>
> >>> -/**<br>
> >>> - * Get either of the 8-component halves of a 16-component register.<br>
> >>> - *<br>
> >>> - * Note: this also works if \c reg represents a SIMD16 pair of registers.<br>
> >>> - */<br>
> >>> -static inline fs_reg<br>
> >>> -half(fs_reg reg, unsigned idx)<br>
> >>> -{<br>
> >>> - assert(idx < 2);<br>
> >>> -<br>
> >>> - switch (reg.file) {<br>
> >>> - case BAD_FILE:<br>
> >>> - case UNIFORM:<br>
> >>> - case IMM:<br>
> >>> - return reg;<br>
> >>> -<br>
> >>> - case GRF:<br>
> >>> - case MRF:<br>
> >>> - assert(reg.width == 16);<br>
> >>> - reg.width = 8;<br>
> >>> - return horiz_offset(reg, 8 * idx);<br>
> >>> -<br>
> >>> - case ATTR:<br>
> >>> - case HW_REG:<br>
> >>> - default:<br>
> >>> - unreachable("Cannot take half of this register type");<br>
> >>> - }<br>
> >>> - return reg;<br>
> >>> -}<br>
> >>> -<br>
> >>> static const fs_reg reg_undef;<br>
> >>><br>
> >>> class fs_inst : public backend_instruction {<br>
> >>> --<br>
> >>> 2.4.3<br>
> >>><br>
> >>> _______________________________________________<br>
> >>> mesa-dev mailing list<br>
> >>> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> >>> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>