nak/nir: Fix the reverse execlist iterator

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30402>
This commit is contained in:
Faith Ekstrand
2024-07-26 17:06:40 -05:00
committed by Marge Bot
parent d19ea8524b
commit f66ca6edc3

View File

@@ -73,15 +73,20 @@ impl<'a, T: 'a> Iterator for ExecListIter<'a, T> {
fn next(&mut self) -> Option<Self::Item> {
if self.rev {
self.n = unsafe { &*self.n.prev };
if self.n.prev.is_null() {
None
} else {
let t: *const c_void = (self.n as *const exec_node).cast();
Some(unsafe { &*(t.sub(self.offset).cast()) })
}
} else {
self.n = unsafe { &*self.n.next };
}
if self.n.next.is_null() {
None
} else {
let t: *const c_void = (self.n as *const exec_node).cast();
Some(unsafe { &*(t.sub(self.offset).cast()) })
if self.n.next.is_null() {
None
} else {
let t: *const c_void = (self.n as *const exec_node).cast();
Some(unsafe { &*(t.sub(self.offset).cast()) })
}
}
}
}