diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index c548ce2ba0e..93669ba4042 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -8621,6 +8621,8 @@ fs_nir_emit_texture(nir_to_brw_state &ntb, header_bits |= instr->component << 16; } + brw_reg nir_def_reg = get_nir_def(ntb, instr->def); + brw_reg dst = bld.vgrf(brw_type_for_nir_type(devinfo, instr->dest_type), 4 + instr->is_sparse); fs_inst *inst = bld.emit(opcode, dst, srcs, ARRAY_SIZE(srcs)); inst->offset = header_bits; @@ -8664,8 +8666,6 @@ fs_nir_emit_texture(nir_to_brw_state &ntb, inst->keep_payload_trailing_zeros = true; } - brw_reg nir_def_reg = get_nir_def(ntb, instr->def); - if (instr->op != nir_texop_query_levels && !instr->is_sparse) { /* In most cases we can write directly to the result. */ inst->dst = nir_def_reg;