Shader-db results on HSW: total instructions in shared programs: 4112172 -> 4111347 (-0.02%) instructions in affected programs: 18265 -> 17440 (-4.52%) helped: 137 HURT: 0 GAINED: 0 LOST: 0 --- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 42c50cb..625a5ae 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -1895,9 +1895,20 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr) is_cube_array, is_rect, sampler, sampler_reg, texunit); fs_reg dest = get_nir_dest(instr->dest); - dest.type = this->result.type; - unsigned num_components = nir_tex_instr_dest_size(instr); - emit_percomp(MOV(dest, this->result), (1 << num_components) - 1); + + fs_inst *inst = (fs_inst *) this->instructions.get_tail(); + if (inst->is_tex() && alloc.sizes[inst->dst.reg] <= alloc.sizes[dest.reg]) { + // The last instruction is the actual texture operation and we have + // enough space in the NIR dest register. Just smash the destination + // with the register from the NIR dest. + assert(inst->dst.file == GRF && dest.file == GRF); + assert(dest.reg_offset == 0); + inst->dst.reg = dest.reg; + } else { + dest.type = this->result.type; + unsigned num_components = nir_tex_instr_dest_size(instr); + emit_percomp(MOV(dest, this->result), (1 << num_components) - 1); + } } void -- 2.3.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev