mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 13:20:14 +01:00
nak: Implement load_sample_id and load_sample_mask_in
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
parent
595f03957c
commit
24c2728ca5
3 changed files with 64 additions and 1 deletions
|
|
@ -1536,6 +1536,22 @@ impl SM75Instr {
|
||||||
self.set_field(72..80, op.idx);
|
self.set_field(72..80, op.idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn encode_pixld(&mut self, op: &OpPixLd) {
|
||||||
|
self.set_opcode(0x925);
|
||||||
|
self.set_dst(op.dst);
|
||||||
|
self.set_field(
|
||||||
|
78..81,
|
||||||
|
match op.val {
|
||||||
|
PixVal::MsCount => 0_u8,
|
||||||
|
PixVal::CovMask => 1_u8,
|
||||||
|
PixVal::CentroidOffset => 2_u8,
|
||||||
|
PixVal::MyIndex => 3_u8,
|
||||||
|
PixVal::InnerCoverage => 4_u8,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
self.set_pred_dst(81..84, Dst::None);
|
||||||
|
}
|
||||||
|
|
||||||
fn encode_s2r(&mut self, op: &OpS2R) {
|
fn encode_s2r(&mut self, op: &OpS2R) {
|
||||||
self.set_opcode(0x919);
|
self.set_opcode(0x919);
|
||||||
self.set_dst(op.dst);
|
self.set_dst(op.dst);
|
||||||
|
|
@ -1605,6 +1621,7 @@ impl SM75Instr {
|
||||||
Op::Exit(op) => si.encode_exit(&op),
|
Op::Exit(op) => si.encode_exit(&op),
|
||||||
Op::Bar(op) => si.encode_bar(&op),
|
Op::Bar(op) => si.encode_bar(&op),
|
||||||
Op::CS2R(op) => si.encode_cs2r(&op),
|
Op::CS2R(op) => si.encode_cs2r(&op),
|
||||||
|
Op::PixLd(op) => si.encode_pixld(&op),
|
||||||
Op::S2R(op) => si.encode_s2r(&op),
|
Op::S2R(op) => si.encode_s2r(&op),
|
||||||
_ => panic!("Unhandled instruction"),
|
_ => panic!("Unhandled instruction"),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1264,6 +1264,22 @@ impl<'a> ShaderFromNir<'a> {
|
||||||
}
|
}
|
||||||
self.set_dst(&intrin.def, dst);
|
self.set_dst(&intrin.def, dst);
|
||||||
}
|
}
|
||||||
|
nir_intrinsic_load_sample_id => {
|
||||||
|
let dst = b.alloc_ssa(RegFile::GPR, 1);
|
||||||
|
b.push_op(OpPixLd {
|
||||||
|
dst: dst.into(),
|
||||||
|
val: PixVal::MyIndex,
|
||||||
|
});
|
||||||
|
self.set_dst(&intrin.def, dst);
|
||||||
|
}
|
||||||
|
nir_intrinsic_load_sample_mask_in => {
|
||||||
|
let dst = b.alloc_ssa(RegFile::GPR, 1);
|
||||||
|
b.push_op(OpPixLd {
|
||||||
|
dst: dst.into(),
|
||||||
|
val: PixVal::CovMask,
|
||||||
|
});
|
||||||
|
self.set_dst(&intrin.def, dst);
|
||||||
|
}
|
||||||
nir_intrinsic_load_scratch => {
|
nir_intrinsic_load_scratch => {
|
||||||
let size_B =
|
let size_B =
|
||||||
(intrin.def.bit_size() / 8) * intrin.def.num_components();
|
(intrin.def.bit_size() / 8) * intrin.def.num_components();
|
||||||
|
|
|
||||||
|
|
@ -3277,6 +3277,35 @@ impl fmt::Display for OpCS2R {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub enum PixVal {
|
||||||
|
MsCount,
|
||||||
|
CovMask,
|
||||||
|
CentroidOffset,
|
||||||
|
MyIndex,
|
||||||
|
InnerCoverage,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(SrcsAsSlice, DstsAsSlice)]
|
||||||
|
pub struct OpPixLd {
|
||||||
|
pub dst: Dst,
|
||||||
|
pub val: PixVal,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for OpPixLd {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "PIXLD")?;
|
||||||
|
match self.val {
|
||||||
|
PixVal::MsCount => write!(f, ".MSCOUNT")?,
|
||||||
|
PixVal::CovMask => write!(f, ".COVMASK")?,
|
||||||
|
PixVal::CentroidOffset => write!(f, ".CENTROID_OFFSET")?,
|
||||||
|
PixVal::MyIndex => write!(f, ".MY_INDEX")?,
|
||||||
|
PixVal::InnerCoverage => write!(f, ".INNER_COVERAGE")?,
|
||||||
|
}
|
||||||
|
write!(f, " {}", self.dst)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(SrcsAsSlice, DstsAsSlice)]
|
#[derive(SrcsAsSlice, DstsAsSlice)]
|
||||||
pub struct OpS2R {
|
pub struct OpS2R {
|
||||||
|
|
@ -3656,6 +3685,7 @@ pub enum Op {
|
||||||
Exit(OpExit),
|
Exit(OpExit),
|
||||||
Bar(OpBar),
|
Bar(OpBar),
|
||||||
CS2R(OpCS2R),
|
CS2R(OpCS2R),
|
||||||
|
PixLd(OpPixLd),
|
||||||
S2R(OpS2R),
|
S2R(OpS2R),
|
||||||
Undef(OpUndef),
|
Undef(OpUndef),
|
||||||
PhiSrcs(OpPhiSrcs),
|
PhiSrcs(OpPhiSrcs),
|
||||||
|
|
@ -4044,7 +4074,7 @@ impl Instr {
|
||||||
Op::Bra(_) | Op::Exit(_) => true,
|
Op::Bra(_) | Op::Exit(_) => true,
|
||||||
|
|
||||||
// Miscellaneous ops
|
// Miscellaneous ops
|
||||||
Op::Bar(_) | Op::CS2R(_) | Op::S2R(_) => false,
|
Op::Bar(_) | Op::CS2R(_) | Op::PixLd(_) | Op::S2R(_) => false,
|
||||||
|
|
||||||
// Virtual ops
|
// Virtual ops
|
||||||
Op::Undef(_)
|
Op::Undef(_)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue