Skip to content

Behavior of discarding everything #2523

@kvark

Description

@kvark

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions