mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 06:45:13 +00:00
Forgot to remove 2 cases of Instruction::new
This commit is contained in:
parent
fc9cc938b5
commit
a49acc1709
@ -1,8 +1,11 @@
|
|||||||
// This pass inserts merge instructions for structured control flow with the assumption the spir-v is reducible.
|
// This pass inserts merge instructions for structured control flow with the assumption the spir-v is reducible.
|
||||||
|
|
||||||
use super::simple_passes::outgoing_edges;
|
use super::simple_passes::outgoing_edges;
|
||||||
use rspirv::dr::{Block, Builder, InsertPoint, Instruction, Module, Operand};
|
|
||||||
use rspirv::spirv::{Op, SelectionControl, Word};
|
use rspirv::spirv::{Op, SelectionControl, Word};
|
||||||
|
use rspirv::{
|
||||||
|
dr::{Block, Builder, InsertPoint, Module, Operand},
|
||||||
|
spirv::LoopControl,
|
||||||
|
};
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use std::collections::{HashMap, VecDeque};
|
use std::collections::{HashMap, VecDeque};
|
||||||
|
|
||||||
@ -742,20 +745,18 @@ pub fn insert_selection_merge_on_conditional_branch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let merge_operands = vec![
|
|
||||||
Operand::IdRef(merge_block_id),
|
|
||||||
Operand::SelectionControl(SelectionControl::NONE),
|
|
||||||
];
|
|
||||||
|
|
||||||
cf_info.if_merge_ids.push(merge_block_id);
|
cf_info.if_merge_ids.push(merge_block_id);
|
||||||
|
|
||||||
// Insert the merge instruction
|
// Insert the merge instruction
|
||||||
let bi = find_block_index_from_id(builder, &id); // after this we don't insert or remove blocks
|
let bi = find_block_index_from_id(builder, &id); // after this we don't insert or remove blocks
|
||||||
let block = get_block_mut!(builder, bi);
|
builder.select_block(Some(bi)).unwrap();
|
||||||
let merge_inst = Instruction::new(Op::SelectionMerge, None, None, merge_operands);
|
builder
|
||||||
block
|
.insert_selection_merge(
|
||||||
.instructions
|
InsertPoint::FromEnd(1),
|
||||||
.insert(block.instructions.len() - 1, merge_inst);
|
merge_block_id,
|
||||||
|
SelectionControl::NONE,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,21 +815,19 @@ pub fn insert_loop_merge_on_conditional_branch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let bi = find_block_index_from_id(builder, &id); // after this we don't insert or remove blocks
|
|
||||||
let check_block = &mut get_blocks_mut(builder)[bi];
|
|
||||||
|
|
||||||
let merge_operands = vec![
|
|
||||||
Operand::IdRef(merge_block_id),
|
|
||||||
Operand::IdRef(continue_block_id),
|
|
||||||
Operand::SelectionControl(SelectionControl::NONE),
|
|
||||||
];
|
|
||||||
|
|
||||||
cf_info.set_loops_continue_and_merge(id, merge_block_id, continue_block_id);
|
cf_info.set_loops_continue_and_merge(id, merge_block_id, continue_block_id);
|
||||||
|
|
||||||
// Insert the merge instruction
|
// Insert the merge instruction
|
||||||
let merge_inst = Instruction::new(Op::LoopMerge, None, None, merge_operands);
|
let bi = find_block_index_from_id(builder, &id); // after this we don't insert or remove blocks
|
||||||
check_block
|
builder.select_block(Some(bi)).unwrap();
|
||||||
.instructions
|
builder
|
||||||
.insert(check_block.instructions.len() - 1, merge_inst);
|
.insert_loop_merge(
|
||||||
|
InsertPoint::FromEnd(1),
|
||||||
|
merge_block_id,
|
||||||
|
continue_block_id,
|
||||||
|
LoopControl::NONE,
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user