nak: Use Instr::num_srcs/dsts() less
Instead use Iterator::enumerate() and is_empty(). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
committed by
Marge Bot
parent
fafb72e2be
commit
438c67c1cb
@@ -155,12 +155,12 @@ impl AllocBarriers {
|
||||
continue;
|
||||
}
|
||||
|
||||
if instr.num_srcs() > 0 {
|
||||
if !instr.srcs().is_empty() {
|
||||
let bar = self.alloc_barrier();
|
||||
instr.deps.set_rd_bar(bar.try_into().unwrap());
|
||||
self.set_instr_read_barrier(instr, bar);
|
||||
}
|
||||
if instr.num_dsts() > 0 {
|
||||
if !instr.dsts().is_empty() {
|
||||
let bar = self.alloc_barrier();
|
||||
instr.deps.set_wr_bar(bar.try_into().unwrap());
|
||||
self.set_instr_write_barrier(instr, bar);
|
||||
|
||||
@@ -1200,7 +1200,7 @@ impl Shader {
|
||||
}
|
||||
Opcode::SPLIT => {
|
||||
let comps = u8::try_from(instr.num_dsts()).unwrap();
|
||||
if instr.num_dsts() == 1 {
|
||||
if comps == 1 {
|
||||
let src = instr.src(0);
|
||||
let dst = instr.dst(0);
|
||||
Instr::new_mov(*dst, *src)
|
||||
@@ -1221,13 +1221,12 @@ impl Shader {
|
||||
}
|
||||
Opcode::FS_OUT => {
|
||||
let mut instrs = Vec::new();
|
||||
for i in 0..instr.num_srcs() {
|
||||
for (i, src) in instr.srcs().iter().enumerate() {
|
||||
let dst = Ref::new_reg(
|
||||
RegFile::GPR,
|
||||
i.try_into().unwrap(),
|
||||
1,
|
||||
);
|
||||
let src = instr.src(i);
|
||||
instrs.push(Instr::new_mov(dst, *src));
|
||||
}
|
||||
Instr::new_meta(instrs)
|
||||
|
||||
Reference in New Issue
Block a user