summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-11-10 21:07:45 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2015-12-12 19:39:02 +0000
commit36ff210d0e0b587db3a889719842627707cceff0 (patch)
tree69071275ab6ab0b52c2cc482bbdd4631d80be07b
parent017f4755fd5631f8ce304c9aabe9fd8cedc0b030 (diff)
i965/nir: Remove unused indirect handling
The one and only place where the FS backend allows reladdr is on uniforms. For locals, inputs, and outputs, we lower it away before the backend ever sees it. This commit gets rid of the dead indirect handling code. Cc: "11.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (cherry picked from commit 22c273de2b97743587310f7bbf66767191bde866)
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp44
1 files changed, 11 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index af8462ed234..c3e7171fabd 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -1101,28 +1101,6 @@ fs_visitor::nir_emit_undef(const fs_builder &bld, nir_ssa_undef_instr *instr)
instr->def.num_components);
}
-static fs_reg
-fs_reg_for_nir_reg(fs_visitor *v, nir_register *nir_reg,
- unsigned base_offset, nir_src *indirect)
-{
- fs_reg reg;
-
- assert(!nir_reg->is_global);
-
- reg = v->nir_locals[nir_reg->index];
-
- reg = offset(reg, v->bld, base_offset * nir_reg->num_components);
- if (indirect) {
- int multiplier = nir_reg->num_components * (v->dispatch_width / 8);
-
- reg.reladdr = new(v->mem_ctx) fs_reg(v->vgrf(glsl_type::int_type));
- v->bld.MUL(*reg.reladdr, v->get_nir_src(*indirect),
- brw_imm_d(multiplier));
- }
-
- return reg;
-}
-
fs_reg
fs_visitor::get_nir_src(nir_src src)
{
@@ -1130,8 +1108,10 @@ fs_visitor::get_nir_src(nir_src src)
if (src.is_ssa) {
reg = nir_ssa_values[src.ssa->index];
} else {
- reg = fs_reg_for_nir_reg(this, src.reg.reg, src.reg.base_offset,
- src.reg.indirect);
+ /* We don't handle indirects on locals */
+ assert(src.reg.indirect == NULL);
+ reg = offset(nir_locals[src.reg.reg->index], bld,
+ src.reg.base_offset * src.reg.reg->num_components);
}
/* to avoid floating-point denorm flushing problems, set the type by
@@ -1148,10 +1128,12 @@ fs_visitor::get_nir_dest(nir_dest dest)
nir_ssa_values[dest.ssa.index] = bld.vgrf(BRW_REGISTER_TYPE_F,
dest.ssa.num_components);
return nir_ssa_values[dest.ssa.index];
+ } else {
+ /* We don't handle indirects on locals */
+ assert(dest.reg.indirect == NULL);
+ return offset(nir_locals[dest.reg.reg->index], bld,
+ dest.reg.base_offset * dest.reg.reg->num_components);
}
-
- return fs_reg_for_nir_reg(this, dest.reg.reg, dest.reg.base_offset,
- dest.reg.indirect);
}
fs_reg
@@ -2447,7 +2429,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
}
case nir_intrinsic_load_input_indirect:
- has_indirect = true;
+ unreachable("Not allowed");
/* fallthrough */
case nir_intrinsic_load_input: {
unsigned index = 0;
@@ -2459,8 +2441,6 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
src = offset(retype(nir_inputs, dest.type), bld,
instr->const_index[0] + index);
}
- if (has_indirect)
- src.reladdr = new(mem_ctx) fs_reg(get_nir_src(instr->src[0]));
index++;
bld.MOV(dest, src);
@@ -2533,7 +2513,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
}
case nir_intrinsic_store_output_indirect:
- has_indirect = true;
+ unreachable("Not allowed");
/* fallthrough */
case nir_intrinsic_store_output: {
fs_reg src = get_nir_src(instr->src[0]);
@@ -2541,8 +2521,6 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
for (unsigned j = 0; j < instr->num_components; j++) {
fs_reg new_dest = offset(retype(nir_outputs, src.type), bld,
instr->const_index[0] + index);
- if (has_indirect)
- src.reladdr = new(mem_ctx) fs_reg(get_nir_src(instr->src[1]));
index++;
bld.MOV(new_dest, src);
src = offset(src, bld, 1);