mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 09:30:11 +01:00
nak/sm50: Get rid of the hand-rolled align_up/down() helpers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30141>
This commit is contained in:
parent
0f7ff6fbdc
commit
69bea2b49f
1 changed files with 2 additions and 10 deletions
|
|
@ -13,14 +13,6 @@ impl Src {
|
|||
}
|
||||
}
|
||||
|
||||
fn align_down(value: usize, align: usize) -> usize {
|
||||
value / align * align
|
||||
}
|
||||
|
||||
fn align_up(value: usize, align: usize) -> usize {
|
||||
align_down(value + (align - 1), align)
|
||||
}
|
||||
|
||||
struct SM50Instr {
|
||||
inst: [u32; 2],
|
||||
sched: u32,
|
||||
|
|
@ -2200,7 +2192,7 @@ impl Shader {
|
|||
// to a schedule instruction, we account for that here.
|
||||
labels.insert(b.label, num_instrs + 8);
|
||||
|
||||
let block_num_instrs = align_up(b.instrs.len(), 3);
|
||||
let block_num_instrs = b.instrs.len().next_multiple_of(3);
|
||||
|
||||
// Every 3 instructions, we have a new schedule instruction so we
|
||||
// need to account for that.
|
||||
|
|
@ -2210,7 +2202,7 @@ impl Shader {
|
|||
let mut encoded = Vec::new();
|
||||
for b in &func.blocks {
|
||||
// A block is composed of groups of 3 instructions.
|
||||
let block_num_instrs = align_up(b.instrs.len(), 3);
|
||||
let block_num_instrs = b.instrs.len().next_multiple_of(3);
|
||||
|
||||
let mut instrs_iter = b.instrs.iter();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue