Skip to content

Function argument type missmatch silently compiled #66

@maxsupermanhd

Description

@maxsupermanhd

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions