Shaders: GFX10 FLAT offsets ignore bit 11
This commit is contained in:
1 parent
ffe310eb20
commit
40f30be0b5
2 files changed
+17
No files matched your search
@@ -403,6 +403,8 @@ impl Instruction {
|
||||
saddr: (self.encoding != Encoding::Flat)
|
||||
.then(|| scalar(saddr, 1 + u8::from(self.encoding == Encoding::Global))),
|
||||
offset: match self.encoding {
|
||||
// GFX10 FLAT offsets are 11-bit and unsigned: the
|
||||
// hardware ignores bit 11.
|
||||
Encoding::Flat => (w0 & 0x7FF) as i16,
|
||||
_ => ((w0 << 4) as i16) >> 4,
|
||||
},
|
||||
|
||||
@@ -352,6 +352,21 @@ mod tests {
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flat_offsets_ignore_bit_eleven() {
|
||||
let offset = |word0: u32| {
|
||||
let code = bytes(&[word0, 0x0000_0001, S_ENDPGM]);
|
||||
match decode(&code).unwrap()[0].fields(false) {
|
||||
Fields::Flat { offset, .. } => offset,
|
||||
fields => panic!("{fields:?}"),
|
||||
}
|
||||
};
|
||||
// flat_load_dword v0, v[1:2]: the FLAT offset is 11-bit and
|
||||
// unsigned, so bit 11 is ignored (0x800 -> 0, 0xfff -> 0x7ff).
|
||||
assert_eq!(offset(0xDC30_0800), 0);
|
||||
assert_eq!(offset(0xDC30_0FFF), 0x7FF);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tables_are_sorted() {
|
||||
for t in [
|
||||
|
||||
Reference in new issue
Block a user