<p dir="ltr"><br>
On Nov 23, 2015 20:51, "Matt Turner" <<a href="mailto:mattst88@gmail.com">mattst88@gmail.com</a>> wrote:<br>
><br>
> On Mon, Nov 23, 2015 at 6:11 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> > The one and only place where the FS backend allows reladdr is on uniforms.<br>
> > For locals, inputs, and outputs, we lower it away before the backend ever<br>
> > sees it. This commit gets rid of the dead indirect handling code.<br>
> > ---<br>
> > src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 44 ++++++++------------------------<br>
> > 1 file changed, 11 insertions(+), 33 deletions(-)<br>
> ><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 062ae08..39111ba 100644<br>
> > --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> > +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> > @@ -1076,28 +1076,6 @@ fs_visitor::nir_emit_undef(const fs_builder &bld, nir_ssa_undef_instr *instr)<br>
> > instr->def.num_components);<br>
> > }<br>
> ><br>
> > -static fs_reg<br>
> > -fs_reg_for_nir_reg(fs_visitor *v, nir_register *nir_reg,<br>
> > - unsigned base_offset, nir_src *indirect)<br>
> > -{<br>
> > - fs_reg reg;<br>
> > -<br>
> > - assert(!nir_reg->is_global);<br>
> > -<br>
> > - reg = v->nir_locals[nir_reg->index];<br>
> > -<br>
> > - reg = offset(reg, v->bld, base_offset * nir_reg->num_components);<br>
> > - if (indirect) {<br>
> > - int multiplier = nir_reg->num_components * (v->dispatch_width / 8);<br>
> > -<br>
> > - reg.reladdr = new(v->mem_ctx) fs_reg(v->vgrf(glsl_type::int_type));<br>
> > - v->bld.MUL(*reg.reladdr, v->get_nir_src(*indirect),<br>
> > - brw_imm_d(multiplier));<br>
> > - }<br>
> > -<br>
> > - return reg;<br>
> > -}<br>
> > -<br>
> > fs_reg<br>
> > fs_visitor::get_nir_src(nir_src src)<br>
> > {<br>
> > @@ -1105,8 +1083,10 @@ fs_visitor::get_nir_src(nir_src src)<br>
> > if (src.is_ssa) {<br>
> > reg = nir_ssa_values[src.ssa->index];<br>
> > } else {<br>
> > - reg = fs_reg_for_nir_reg(this, src.reg.reg, src.reg.base_offset,<br>
> > - src.reg.indirect);<br>
> > + /* We don't handle indirects on locals */<br>
> > + assert(src.reg.indirect == NULL);<br>
> > + reg = offset(nir_locals[src.reg.reg->index], bld,<br>
> > + src.reg.base_offset * src.reg.reg->num_components);<br>
> > }<br>
> ><br>
> > /* to avoid floating-point denorm flushing problems, set the type by<br>
> > @@ -1123,10 +1103,12 @@ fs_visitor::get_nir_dest(nir_dest dest)<br>
> > nir_ssa_values[dest.ssa.index] = bld.vgrf(BRW_REGISTER_TYPE_F,<br>
> > dest.ssa.num_components);<br>
> > return nir_ssa_values[dest.ssa.index];<br>
> > + } else {<br>
> > + /* We don't handle indirects on locals */<br>
> > + assert(dest.reg.indirect == NULL);<br>
> > + return offset(nir_locals[dest.reg.reg->index], bld,<br>
> > + dest.reg.base_offset * dest.reg.reg->num_components);<br>
> > }<br>
> > -<br>
> > - return fs_reg_for_nir_reg(this, dest.reg.reg, dest.reg.base_offset,<br>
> > - dest.reg.indirect);<br>
> > }<br>
> ><br>
> > fs_reg<br>
> > @@ -2422,7 +2404,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> > }<br>
> ><br>
> > case nir_intrinsic_load_input_indirect:<br>
> > - has_indirect = true;<br>
> > + assert(!"Not allowed");<br>
><br>
> unreachable<br>
><br>
> > /* fallthrough */<br>
> > case nir_intrinsic_load_input: {<br>
> > unsigned index = 0;<br>
> > @@ -2434,8 +2416,6 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> > src = offset(retype(nir_inputs, dest.type), bld,<br>
> > instr->const_index[0] + index);<br>
> > }<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>
> > @@ -2508,7 +2488,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> > }<br>
> ><br>
> > case nir_intrinsic_store_output_indirect:<br>
> > - has_indirect = true;<br>
> > + assert(!"Not allowed");<br>
><br>
> unreachable</p>
<p dir="ltr">Sure.</p>
<p dir="ltr">> > /* fallthrough */<br>
> > case nir_intrinsic_store_output: {<br>
> > fs_reg src = get_nir_src(instr->src[0]);<br>
> > @@ -2516,8 +2496,6 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr<br>
> > for (unsigned j = 0; j < instr->num_components; j++) {<br>
> > fs_reg new_dest = offset(retype(nir_outputs, src.type), bld,<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, bld, 1);<br>
> > --<br>
> > 2.5.0.400.gff86faf<br>
</p>