gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.82k stars 939 forks source link

[wgsl-out] Support switch fallthrough #4415

Open teoxoy opened 1 year ago

teoxoy commented 1 year ago

Check out the HLSL backend's workaround for this and implement it for our WGSL backend as well.

Vipitis commented 1 year ago

I have reached the fall-through switch case block return when translating glsl to wgsl where the switch cases were const int. Here is a minimal example (via wgpu-py shadertoy utility from https://www.shadertoy.com/view/DtccWr source).

As this seems to be a return message and not a raised error. This eventually causes wgpu to panic with a SemanticError("Case values can only be integers").

Is this related to the TODO comment here or should I open another issue?

teoxoy commented 1 year ago

If GLSL allows those, that would be an enhancement for the GLSL frontend (different issue).