Skip to content

[naga] Subtractions don't work without whitespace. #4941

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

Closed
alister-chowdhury opened this issue Dec 28, 2023 · 3 comments
Closed

[naga] Subtractions don't work without whitespace. #4941

alister-chowdhury opened this issue Dec 28, 2023 · 3 comments

Comments

@alister-chowdhury
Copy link

alister-chowdhury commented Dec 28, 2023

Description

It seems naga is unable to handle subtracting a number without there being a whitespae between it, which sounds like the lexer order is a bit iffy.

Repro steps

@fragment 
fn main(@location(0) A: vec4f) -> @location(0) vec4f {
    let a = A-2.;
    return a;
}

naga example.frag.wgsl

By comparison, this is deemed ok:

@fragment 
fn main(@location(0) A: vec4f) -> @location(0) vec4f {
    let a = A - 2.;
    return a;
}

Tint seems to have no issue parsing this.

Platform
On x64 Win10, using the latest naga.
naga version: 0.14.0

@teoxoy
Copy link
Member

teoxoy commented Jan 2, 2024

I think this was fixed by #4870. Could you try that commit or latest trunk?

@alister-chowdhury
Copy link
Author

cargo run example.frag.wgsll

Seemed to work!
Many thanks, closing ticket!

(I assume I tested this correctly, cloned the repo at trunk and did cargo run from wgpu/naga-cli

@cwfitzgerald
Copy link
Member

Sounds correct to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants