nak: Plumb uses_kill through from nak_from_nir

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Faith Ekstrand 2023-09-18 15:47:48 -05:00 committed by Marge Bot
parent 274d521c22
commit e9bad677af
3 changed files with 12 additions and 2 deletions

View file

@ -236,9 +236,8 @@ fn encode_hdr_for_nir(
cw0.set_field(10..14, shader_type);
if let ShaderStageInfo::Fragment(fs_info) = &shader_info.stage {
cw0.set_bit(14, fs_info.writes_color > 0xf);
let info_fs = unsafe { &nir.info.__bindgen_anon_1.fs };
let zs_self_dep = fs_key.map_or(false, |key| key.zs_self_dep);
cw0.set_bit(15, info_fs.uses_discard() || zs_self_dep);
cw0.set_bit(15, fs_info.uses_kill || zs_self_dep);
}
cw0.set_bit(16, false /* TODO: DoesGlobalStore */);
cw0.set_field(17..21, 1_u32 /* SassVersion */);

View file

@ -1193,9 +1193,19 @@ impl<'a> ShaderFromNir<'a> {
});
}
nir_intrinsic_demote | nir_intrinsic_discard => {
if let ShaderStageInfo::Fragment(info) = &mut self.info.stage {
info.uses_kill = true;
} else {
panic!("OpKill is only available in fragment shaders");
}
b.push_op(OpKill {});
}
nir_intrinsic_demote_if | nir_intrinsic_discard_if => {
if let ShaderStageInfo::Fragment(info) = &mut self.info.stage {
info.uses_kill = true;
} else {
panic!("OpKill is only available in fragment shaders");
}
let cond = self.get_ssa(&srcs[0].as_def())[0];
b.predicate(cond.into()).push_op(OpKill {});
}

View file

@ -4458,6 +4458,7 @@ pub struct ComputeShaderInfo {
#[derive(Debug, Default)]
pub struct FragmentShaderInfo {
pub reads_sample_mask: bool,
pub uses_kill: bool,
pub writes_color: u32,
pub writes_sample_mask: bool,
pub writes_depth: bool,