nak: Don't print the destination of OpIpa twice
While we're here, also implement Display for InterpFreq and InterpLoc and simplify printing a bit. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30218>
This commit is contained in:

committed by
Marge Bot

parent
ef88597ebb
commit
3619ec9630
@@ -2269,6 +2269,16 @@ pub enum InterpFreq {
|
||||
State,
|
||||
}
|
||||
|
||||
impl fmt::Display for InterpFreq {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
InterpFreq::Pass => write!(f, ".pass"),
|
||||
InterpFreq::PassMulW => write!(f, ".pass_mul_w"),
|
||||
InterpFreq::Constant => write!(f, ".constant"),
|
||||
InterpFreq::State => write!(f, ".state"),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub enum InterpLoc {
|
||||
Default,
|
||||
@@ -2276,6 +2286,16 @@ pub enum InterpLoc {
|
||||
Offset,
|
||||
}
|
||||
|
||||
impl fmt::Display for InterpLoc {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
InterpLoc::Default => Ok(()),
|
||||
InterpLoc::Centroid => write!(f, ".centroid"),
|
||||
InterpLoc::Offset => write!(f, ".offset"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct AttrAccess {
|
||||
pub addr: u16,
|
||||
pub comps: u8,
|
||||
@@ -4351,20 +4371,11 @@ pub struct OpIpa {
|
||||
|
||||
impl DisplayOp for OpIpa {
|
||||
fn fmt_op(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "ipa")?;
|
||||
match self.freq {
|
||||
InterpFreq::Pass => write!(f, ".pass")?,
|
||||
InterpFreq::PassMulW => write!(f, ".pass_mul_w")?,
|
||||
InterpFreq::Constant => write!(f, ".constant")?,
|
||||
InterpFreq::State => write!(f, ".state")?,
|
||||
}
|
||||
match self.loc {
|
||||
InterpLoc::Default => (),
|
||||
InterpLoc::Centroid => write!(f, ".centroid")?,
|
||||
InterpLoc::Offset => write!(f, ".offset")?,
|
||||
}
|
||||
|
||||
write!(f, " {} a[{:#x}] {}", self.dst, self.addr, self.inv_w)?;
|
||||
write!(
|
||||
f,
|
||||
"ipa{}{} a[{:#x}] {}",
|
||||
self.freq, self.loc, self.addr, self.inv_w
|
||||
)?;
|
||||
if self.loc == InterpLoc::Offset {
|
||||
write!(f, " {}", self.offset)?;
|
||||
}
|
||||
|
Reference in New Issue
Block a user