Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ennis opened this issue Aug 8, 2023 · 0 comments · Fixed by #2428
Closed

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

ennis opened this issue Aug 8, 2023 · 0 comments · Fixed by #2428
Labels
area: front-end Input formats for conversion area: validation Validation of the IR lang: WGSL WebGPU shading language

Comments

@ennis
Copy link

ennis commented Aug 8, 2023

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.

@teoxoy teoxoy added lang: WGSL WebGPU shading language area: front-end Input formats for conversion area: validation Validation of the IR labels Aug 8, 2023
@teoxoy teoxoy added this to the WGSL Specification V1 milestone Aug 8, 2023
fornwall added a commit to fornwall/naga that referenced this issue Aug 10, 2023
fornwall added a commit to fornwall/naga that referenced this issue Aug 11, 2023
fornwall added a commit to fornwall/naga that referenced this issue Aug 11, 2023
fornwall added a commit to fornwall/naga that referenced this issue Aug 11, 2023
teoxoy pushed a commit that referenced this issue Aug 13, 2023
* [wgsl-in] Fail on repeated attributes

Fixes #2425.

* [wgsl-in] Use ParsedAttribute to keep track of parsed attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: front-end Input formats for conversion area: validation Validation of the IR lang: WGSL WebGPU shading language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants