Skip to content

Commit

Permalink
heh, generics
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev committed Dec 16, 2024
1 parent f5511b3 commit bc9b1d2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions wgpu/src/backend/wgpu_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,23 +411,26 @@ fn map_load_op<V: Default>(op: LoadOp<V>) -> (wgc::command::LoadOp, V) {
}
}

fn map_pass_channel<V: Copy + Default>(
fn map_pass_channel<T: TryFrom<V> + Default, V: Copy + Default>(
ops: Option<&Operations<V>>,
) -> wgc::command::PassChannel<V> {
) -> wgc::command::PassChannel<T>
where
<T as std::convert::TryFrom<V>>::Error: std::fmt::Debug,
{
match ops {
Some(&Operations { load, store }) => {
let (load_op, clear_value) = map_load_op(load);
wgc::command::PassChannel {
load_op: Some(load_op),
store_op: Some(map_store_op(store)),
clear_value,
clear_value: clear_value.try_into().unwrap(),
read_only: false,
}
}
None => wgc::command::PassChannel {
load_op: None,
store_op: None,
clear_value: V::default(),
clear_value: T::default(),
read_only: true,
},
}
Expand Down

0 comments on commit bc9b1d2

Please sign in to comment.