Skip to content

"Instructions after return" is reported incorrectly #7536

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

Open
andyleiserson opened this issue Apr 14, 2025 · 2 comments · May be fixed by #7554
Open

"Instructions after return" is reported incorrectly #7536

andyleiserson opened this issue Apr 14, 2025 · 2 comments · May be fixed by #7554
Assignees
Labels
area: correctness We're behaving incorrectly area: naga processing Passes over IR in the middle lang: WGSL WebGPU Shading Language type: bug Something isn't working

Comments

@andyleiserson
Copy link
Contributor

This failure appears in https://shi-yan.github.io/webgpuunleashed/code/code.html#5_04_mega_texture, via https://bugzilla.mozilla.org/show_bug.cgi?id=1911496.

The shader fails with:

Shader validation error: Entry point fs_main at Fragment is invalid
   ┌─ :54:12
   │
54 │     return vec4(1.0,0.0,0.0,1.0);
   │            ^^^^^^^^^^^^^^^^^^^^^ instructions after return
   │
   = There are instructions after `return`/`break`/`continue`
@andyleiserson andyleiserson added type: bug Something isn't working area: correctness We're behaving incorrectly lang: WGSL WebGPU Shading Language area: naga processing Passes over IR in the middle labels Apr 14, 2025
@andyleiserson
Copy link
Contributor Author

This shader has a discard followed by the return shown in the error message. I think the real issue here is that we treat There are instructions after `return`/`break`/`continue` as an error. Unreachable code may be poor style, but it's allowed by the spec.

@cwfitzgerald
Copy link
Member

It used to be disallowed, which is where the rule came from

@andyleiserson andyleiserson self-assigned this Apr 15, 2025
andyleiserson added a commit to andyleiserson/wgpu that referenced this issue Apr 16, 2025
@andyleiserson andyleiserson linked a pull request Apr 16, 2025 that will close this issue
6 tasks
@andyleiserson andyleiserson moved this from Todo to In Progress in WebGPU for Firefox Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: correctness We're behaving incorrectly area: naga processing Passes over IR in the middle lang: WGSL WebGPU Shading Language type: bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants