mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-25 08:14:12 +00:00
Keep PassMode
by reference instead of value.
This commit is contained in:
parent
4d22af493f
commit
69fb9e3188
@ -170,7 +170,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
&mut self,
|
||||
result_type: Word,
|
||||
args: &[SpirvValue],
|
||||
pass_mode: PassMode,
|
||||
pass_mode: &PassMode,
|
||||
) -> SpirvValue {
|
||||
match pass_mode {
|
||||
PassMode::Ignore => {
|
||||
@ -181,7 +181,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
}
|
||||
// PassMode::Pair is identical to PassMode::Direct - it's returned as a struct
|
||||
PassMode::Direct(_) | PassMode::Pair(_, _) => (),
|
||||
PassMode::Cast(_) => {
|
||||
PassMode::Cast(_, _) => {
|
||||
self.fatal("PassMode::Cast not supported in codegen_buffer_load_intrinsic")
|
||||
}
|
||||
PassMode::Indirect { .. } => {
|
||||
@ -342,14 +342,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
}
|
||||
|
||||
/// Note: DOES NOT do bounds checking! Bounds checking is expected to be done in the caller.
|
||||
pub fn codegen_buffer_store_intrinsic(&mut self, args: &[SpirvValue], pass_mode: PassMode) {
|
||||
pub fn codegen_buffer_store_intrinsic(&mut self, args: &[SpirvValue], pass_mode: &PassMode) {
|
||||
// Signature: fn store<T>(array: &[u32], index: u32, value: T);
|
||||
let is_pair = match pass_mode {
|
||||
// haha shrug
|
||||
PassMode::Ignore => return,
|
||||
PassMode::Direct(_) => false,
|
||||
PassMode::Pair(_, _) => true,
|
||||
PassMode::Cast(_) => {
|
||||
PassMode::Cast(_, _) => {
|
||||
self.fatal("PassMode::Cast not supported in codegen_buffer_store_intrinsic")
|
||||
}
|
||||
PassMode::Indirect { .. } => {
|
||||
|
@ -121,13 +121,13 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
self.unroll_loops_decorations.borrow_mut().insert(fn_id);
|
||||
}
|
||||
if attrs.buffer_load_intrinsic.is_some() {
|
||||
let mode = fn_abi.ret.mode;
|
||||
let mode = &fn_abi.ret.mode;
|
||||
self.buffer_load_intrinsic_fn_id
|
||||
.borrow_mut()
|
||||
.insert(fn_id, mode);
|
||||
}
|
||||
if attrs.buffer_store_intrinsic.is_some() {
|
||||
let mode = fn_abi.args.last().unwrap().mode;
|
||||
let mode = &fn_abi.args.last().unwrap().mode;
|
||||
self.buffer_store_intrinsic_fn_id
|
||||
.borrow_mut()
|
||||
.insert(fn_id, mode);
|
||||
|
@ -67,9 +67,9 @@ pub struct CodegenCx<'tcx> {
|
||||
/// Simple `panic!("...")` and builtin panics (from MIR `Assert`s) call `#[lang = "panic"]`.
|
||||
pub panic_fn_id: Cell<Option<Word>>,
|
||||
/// Intrinsic for loading a <T> from a &[u32]. The PassMode is the mode of the <T>.
|
||||
pub buffer_load_intrinsic_fn_id: RefCell<FxHashMap<Word, PassMode>>,
|
||||
pub buffer_load_intrinsic_fn_id: RefCell<FxHashMap<Word, &'tcx PassMode>>,
|
||||
/// Intrinsic for storing a <T> into a &[u32]. The PassMode is the mode of the <T>.
|
||||
pub buffer_store_intrinsic_fn_id: RefCell<FxHashMap<Word, PassMode>>,
|
||||
pub buffer_store_intrinsic_fn_id: RefCell<FxHashMap<Word, &'tcx PassMode>>,
|
||||
/// Builtin bounds-checking panics (from MIR `Assert`s) call `#[lang = "panic_bounds_check"]`.
|
||||
pub panic_bounds_check_fn_id: Cell<Option<Word>>,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user