For some reason following compiles just fine, is that correct?
fn u64_shl(a: vec2<u32>, n: u32) -> vec2<u32> {
if (n == 0u) { return a; }
if (n >= 64u) { return vec2<u32>(0u, 0u); }
if (n >= 32u) { return vec2<u32>(0u, a.x << (n - 32u)); }
return vec2<u32>(a.x << n, (a.y << n) | (a.x >> (32u - n)));
}
@compute @workgroup_size(1)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
let a = vec2<u32>(0x41424344u, 0x45464748u);
let b = vec2<u32>(0x41424344u, 0x45464748u);
u64_shl(a, b);
}
u64_shl 2nd arg is u32 but I pass vec2<u32> and it's perfectly fine about it (causes segfault later when creating compute pipeline in my case though)
note I am new to wgsl
For some reason following compiles just fine, is that correct?
u64_shl 2nd arg is
u32but I passvec2<u32>and it's perfectly fine about it (causes segfault later when creating compute pipeline in my case though)note I am new to wgsl