diff options
Diffstat (limited to 'src/intel/compiler/brw_fs_nir.cpp')
-rw-r--r-- | src/intel/compiler/brw_fs_nir.cpp | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index f6c209b77e4..3456d974b6b 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -3352,17 +3352,14 @@ fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld, } case nir_intrinsic_demote: - case nir_intrinsic_discard: case nir_intrinsic_demote_if: + abort(); + + case nir_intrinsic_discard: case nir_intrinsic_discard_if: { - /* We track our discarded pixels in f0.1. By predicating on it, we can - * update just the flag bits that aren't yet discarded. If there's no - * condition, we emit a CMP of g0 != g0, so all currently executing - * channels will get turned off. - */ fs_inst *cmp = NULL; - if (instr->intrinsic == nir_intrinsic_demote_if || - instr->intrinsic == nir_intrinsic_discard_if) { + + if (instr->intrinsic == nir_intrinsic_discard_if) { nir_alu_instr *alu = nir_src_as_alu_instr(instr->src[0]); if (alu != NULL && @@ -3387,40 +3384,21 @@ fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld, cmp = (fs_inst *) instructions.get_tail(); if (cmp->conditional_mod == BRW_CONDITIONAL_NONE) { if (cmp->can_do_cmod()) - cmp->conditional_mod = BRW_CONDITIONAL_Z; + cmp->conditional_mod = BRW_CONDITIONAL_NZ; else cmp = NULL; - } else { - /* The old sequence that would have been generated is, - * basically, bool_result == false. This is equivalent to - * !bool_result, so negate the old modifier. - */ - cmp->conditional_mod = brw_negate_cmod(cmp->conditional_mod); } } if (cmp == NULL) { cmp = bld.CMP(bld.null_reg_f(), get_nir_src(instr->src[0]), - brw_imm_d(0), BRW_CONDITIONAL_Z); + brw_imm_d(0), BRW_CONDITIONAL_NZ); } - } else { - fs_reg some_reg = fs_reg(retype(brw_vec8_grf(0, 0), - BRW_REGISTER_TYPE_UW)); - cmp = bld.CMP(bld.null_reg_f(), some_reg, some_reg, BRW_CONDITIONAL_NZ); - } - - cmp->predicate = BRW_PREDICATE_NORMAL; - cmp->flag_subreg = 1; - - if (devinfo->gen >= 6) { - /* Due to the way we implement discard, the jump will only happen - * when the whole quad is discarded. So we can do this even for - * demote as it won't break its uniformity promises. - */ - emit_discard_jump(); } - limit_dispatch_width(16, "Fragment discard/demote not implemented in SIMD32 mode."); + fs_inst *jump = bld.emit(FS_OPCODE_DISCARD_JUMP); + if (instr->intrinsic == nir_intrinsic_discard_if) + set_predicate(BRW_PREDICATE_NORMAL, jump); break; } |