Skip to content

[enums] Should an enum be host-shareable? #6330

Description

@dj2

The proposal marks an enum as not host-shareable. It would be useful if they are but there are validation questions which arise.

The enums do not allow values which are not specified in the enum. So, if we receive an enum from the host we have to validate that it is within the enum range of values. Currently this works in the proposal because the values come as the underlying types and must be cast to the enum. That cast does the required validation.

If we allowed the enum to be host-shareable we'd need to do the validation each time the value is read out of the structure. This adds validation at each usage site, which is a potential unexpected cost for the programmer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    Status
    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions