gfx-rs / naga

Universal shader translation in Rust

Home Page:https://github.com/gfx-rs/wgpu/tree/trunk/naga

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[wgsl-in] attributes appearing more than once are not rejected

ennis opened this issue · comments

This shader compiles:

struct FragmentIn {
    @location(0) @location(1) color: vec4<f32>,
}

@fragment
fn main(in: FragmentIn) -> @location(0) @location(1) vec4<f32> {
    return vec4<f32>(in.color.rgb, in.color.a);
}

even though the location attribute appears more than once on the struct member and the return type of the entry point (in this case, the last specified location appears to be taken into account). The WGSL spec says in 11. Attributes:

Unless explicitly permitted below, an attribute must not be specified more than once per object or type.

I'm not sure whether this means a diagnostic is required, or even that the compilation should fail.