Skip to content

feat(webgpu): use real flags#71

Merged
MendyBerger merged 1 commit into
WebAssembly:mainfrom
MendyBerger:constants
Jun 4, 2026
Merged

feat(webgpu): use real flags#71
MendyBerger merged 1 commit into
WebAssembly:mainfrom
MendyBerger:constants

Conversation

@MendyBerger

@MendyBerger MendyBerger commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Resolves #59

@MendyBerger MendyBerger requested a review from seanisom June 2, 2026 21:14
Comment thread webgpu/webgpu.wit
green,
blue,
alpha,
all,

@programmerjake programmerjake Jun 3, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there be a separate flag for all or should you just or all the other flags? idk the exact semantics of wit flags, but it seems likely all is intended to be the bitwise-or of all other flags rather than a separate flag

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @programmerjake , great call out!

Let me try to see if I can find any docs why it was added in the first place. Might just be convenience.

In general, we try not to deviate from the WebGPU spec, unless the spec assumes a web feature (e.g. canvas) or a js feature (e.g. function overloading).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, after looking into it, I think it's just a convenience flag for bitwise or-ing all colors.

As I stated above, we try not to deviate from the WebGPU spec unless the spec assumed a web or js feature. I don't think this is such a case, so lets just stick to what the WebGPU working group decided.

And we should document the that these are the only cases when we deviate from the WebGPU spec.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes me think flags should support stuff like:

flags gpu-color-write {
    red,
    green,
    blue,
    alpha,
    all = red | green | blue | alpha,
}

that is what the webgpu.h header file does

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a nice quality of life change to wit that should be pretty easy implement. Would you open a feature request on https://github.com/WebAssembly/component-model?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MendyBerger MendyBerger merged commit f8a90dc into WebAssembly:main Jun 4, 2026
1 check failed
@MendyBerger MendyBerger deleted the constants branch June 4, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use flags for gpu-flags-constant

3 participants