Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

[wgsl-in] Comparing scalar with vector type incorrectly passes validation #2439

@Wumpf

Description

@Wumpf

Spec says both sides of the comparision need to have the same type.
https://www.w3.org/TR/WGSL/#comparison-expr

The following snippet should therefore not pass validation.

const some_vec = vec3<f32>(1.0, 1.0, 1.0);

@fragment
fn main() -> @location(0) vec4<f32> {
    if (all(1.0 < some_vec)) {
        return vec4(0.0);
    }
    return vec4(1.0);
}

Note that Chrome will already correctly reject this, whereas Naga doesn't

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: front-endInput formats for conversionkind: bugSomething isn't workinglang: WGSLWebGPU shading language

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions