nak: Plumb through LDC modes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28474>
This commit is contained in:
Faith Ekstrand
2024-03-29 11:14:19 -05:00
committed by Marge Bot
parent 189b4193ee
commit f4ac517cc8
3 changed files with 32 additions and 2 deletions
+9 -1
View File
@@ -1492,7 +1492,15 @@ impl SM70Instr {
);
self.set_mem_type(73..76, op.mem_type);
self.set_field(78..80, 0_u8); // subop
self.set_field(
78..80,
match op.mode {
LdcMode::Indexed => 0_u8,
LdcMode::IndexedLinear => 1_u8,
LdcMode::IndexedSegmented => 2_u8,
LdcMode::IndexedSegmentedLinear => 3_u8,
},
);
}
fn encode_stg(&mut self, op: &OpSt) {
+2
View File
@@ -2502,10 +2502,12 @@ impl<'a> ShaderFromNir<'a> {
dst: dst.into(),
cb: cb.into(),
offset: off,
mode: LdcMode::Indexed,
mem_type: MemType::from_size(size_B, false),
});
}
} else {
panic!("Indirect UBO indices not yet supported");
}
self.set_dst(&intrin.def, dst);
+21 -1
View File
@@ -3811,6 +3811,25 @@ impl DisplayOp for OpLd {
}
impl_display_for_op!(OpLd);
#[allow(dead_code)]
pub enum LdcMode {
Indexed,
IndexedLinear,
IndexedSegmented,
IndexedSegmentedLinear,
}
impl fmt::Display for LdcMode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
LdcMode::Indexed => Ok(()),
LdcMode::IndexedLinear => write!(f, ".il"),
LdcMode::IndexedSegmented => write!(f, ".is"),
LdcMode::IndexedSegmentedLinear => write!(f, ".isl"),
}
}
}
#[repr(C)]
#[derive(SrcsAsSlice, DstsAsSlice)]
pub struct OpLdc {
@@ -3822,6 +3841,7 @@ pub struct OpLdc {
#[src_type(GPR)]
pub offset: Src,
pub mode: LdcMode,
pub mem_type: MemType,
}
@@ -3830,7 +3850,7 @@ impl DisplayOp for OpLdc {
let SrcRef::CBuf(cb) = self.cb.src_ref else {
panic!("Not a cbuf");
};
write!(f, "ldc{} {}[", self.mem_type, cb.buf)?;
write!(f, "ldc{}{} {}[", self.mode, self.mem_type, cb.buf)?;
if self.offset.is_zero() {
write!(f, "+{:#x}", cb.offset)?;
} else if cb.offset == 0 {