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

Behavior of discarding everything #2523

Closed
kvark opened this issue Jan 21, 2022 · 2 comments
Closed

Behavior of discarding everything #2523

kvark opened this issue Jan 21, 2022 · 2 comments
Labels
wgsl WebGPU Shading Language Issues
Milestone

Comments

@kvark
Copy link
Contributor

kvark commented Jan 21, 2022

Highly related to gfx-rs/naga#2378

During the office hour we discussed a case where all control flow ends with discard, and whether we want to support it.
It conflicts with this rule in the behavioral spec:

If the function has a return type, the behavior of its body must be one of {Return} or {Return, Discard}.

I raised the concern that this restriction feels artificial and unhelpful, and that we should also allow {Discard} behavior. So here comes this issue.

To support this notion, here is a real-world use case which we'd have to reject if we keep the rule unchanged: gfx-rs/wgpu#4458

@dneto0
Copy link
Contributor

dneto0 commented Jan 21, 2022

This was originally raised in gfx-rs/naga#2515, and I think that was closed because the resolution is tied up with gfx-rs/naga#2378

@kdashg
Copy link
Contributor

kdashg commented May 18, 2022

WGSL meeting minutes 2022-05-17
  • KG: Might be resolved.
  • AB: Would like to leave as is. We know Naga has seen case from code generator. Given problems in metal backend feel like changing code gen is easier to not do unconditional discard. Not big change and makes a bunch of stuff easier to explain.
  • KG: As long as has satisfactory workaround, fine for v1?
  • AB: Yea
  • KG: Happy with that. Will copy notes and mark closed.

@kdashg kdashg closed this as completed May 18, 2022
github-merge-queue bot pushed a commit to bevyengine/bevy that referenced this issue Oct 10, 2024
# Objective

- Fixes #15781

## Solution

- DX12 backend seems to require functions with return types to return
value. [WebGPU spec also requires
this](https://gpuweb.github.io/gpuweb/wgsl/#behaviors-rules).

Upstream issue: gfx-rs/wgpu#4458
gpuweb/gpuweb#2523

## Testing

- Tested `order_independent_transparency` example with both dx12 and
vulkan backend on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wgsl WebGPU Shading Language Issues
Projects
None yet
Development

No branches or pull requests

4 participants