nak/sm50: Implement OpPixLd

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30281>
This commit is contained in:
Faith Ekstrand
2024-07-12 12:26:17 -05:00
committed by Marge Bot
parent 69be07b191
commit 9b4a005bf8
3 changed files with 44 additions and 9 deletions

View File

@@ -4832,11 +4832,27 @@ impl_display_for_op!(OpNop);
pub enum PixVal {
MsCount,
CovMask,
Covered,
Offset,
CentroidOffset,
MyIndex,
InnerCoverage,
}
impl fmt::Display for PixVal {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
PixVal::MsCount => write!(f, ".mscount"),
PixVal::CovMask => write!(f, ".covmask"),
PixVal::Covered => write!(f, ".covered"),
PixVal::Offset => write!(f, ".offset"),
PixVal::CentroidOffset => write!(f, ".centroid_offset"),
PixVal::MyIndex => write!(f, ".my_index"),
PixVal::InnerCoverage => write!(f, ".inner_coverage"),
}
}
}
#[repr(C)]
#[derive(SrcsAsSlice, DstsAsSlice)]
pub struct OpPixLd {
@@ -4846,14 +4862,7 @@ pub struct OpPixLd {
impl DisplayOp for OpPixLd {
fn fmt_op(&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, "pixld{}", self.val)
}
}
impl_display_for_op!(OpPixLd);

View File

@@ -2746,6 +2746,30 @@ impl SM50Op for OpNop {
}
}
impl SM50Op for OpPixLd {
fn legalize(&mut self, _b: &mut LegalizeBuilder) {
// Nothing to do
}
fn encode(&self, e: &mut SM50Encoder<'_>) {
e.set_opcode(0xefe8);
e.set_dst(self.dst);
e.set_reg_src(8..16, 0.into());
e.set_field(
31..34,
match &self.val {
PixVal::CovMask => 1_u8,
PixVal::Covered => 2_u8,
PixVal::Offset => 3_u8,
PixVal::CentroidOffset => 4_u8,
PixVal::MyIndex => 5_u8,
other => panic!("Unsupported PixVal: {other}"),
},
);
e.set_pred_dst(45..48, Dst::None);
}
}
impl SM50Op for OpS2R {
fn legalize(&mut self, _b: &mut LegalizeBuilder) {
// Nothing to do
@@ -2882,6 +2906,7 @@ macro_rules! as_sm50_op_match {
Op::Kill(op) => op,
Op::CS2R(op) => op,
Op::Nop(op) => op,
Op::PixLd(op) => op,
Op::Isberd(op) => op,
Op::Out(op) => op,
Op::Bfe(op) => op,

View File

@@ -3239,12 +3239,13 @@ impl SM70Op for OpPixLd {
e.set_dst(self.dst);
e.set_field(
78..81,
match self.val {
match &self.val {
PixVal::MsCount => 0_u8,
PixVal::CovMask => 1_u8,
PixVal::CentroidOffset => 2_u8,
PixVal::MyIndex => 3_u8,
PixVal::InnerCoverage => 4_u8,
other => panic!("Unsupported PixVal: {other}"),
},
);
e.set_pred_dst(81..84, Dst::None);