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

[wgsl-in] Rejection of composite consts without explicit nested types #1957

Closed
hanawatson opened this issue May 29, 2022 · 0 comments · Fixed by #2266
Closed

[wgsl-in] Rejection of composite consts without explicit nested types #1957

hanawatson opened this issue May 29, 2022 · 0 comments · Fixed by #2266
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: WGSL WebGPU shading language

Comments

@hanawatson
Copy link

Even though the types are specified in the declaration of the const, naga rejects consts that are composite if they omit type information from their constructors.

WGSL:

let const0: vec3<f32> = vec3(0.0, 0.0, 0.0);

@stage(compute) @workgroup_size(1)
fn main() {
    var var0 = 0;
}

Error:

        error: expected '<', found '('
          ┌─ test.wgsl:1:29
          │
        1 │ let const0: vec3<f32> = vec3(0.0, 0.0, 0.0);
          │                             ^ expected '<'
        
        Could not parse WGSL

The above works fine if given e.g. vec3<f32>(0.0, 0.0, 0.0). I believe it should be acceptable to omit the type in the constructor.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: WGSL WebGPU shading language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants