I can't seem to figure out how or if it is acually possible to pass acallback to a function in WGSL. I would like to make something along these lines.
fn foo(x: f32, bar: ?callback?) {
bar(x);
}
fn baz(y: f32) -> f32 {
return y 1;
}
@compute
fn main() {
foo(5, baz) // => 6
}
My intelisense hinted me
bar: Fn
but compiler doesn't like that.
CodePudding user response:
WGSL does not have function pointers, so you can't pass a function as a parameter.