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

sysgpu: provide clear default values instead of WebGPU 'undefined' default values #1159

Open
silversquirl opened this issue Feb 12, 2024 · 3 comments
Labels
bug Something isn't working sysgpu

Comments

@silversquirl
Copy link
Contributor

eg. the default value for the type field of Buffer.BindingLayout should be uniform, according to the WebGPU spec.
The undefined buffer type should only be used in the default value of the buffer on BindGroupLayout.Entry, in order to show that those fields are empty.

The default values of the structs themselves should match WebGPU spec, so that if someone tries to use the defaults they get the expected behaviour instead of a confusing validation error :)

@silversquirl silversquirl added bug Something isn't working needs-triage Issues that need triaging labels Feb 12, 2024
@slimsag
Copy link
Member

slimsag commented Feb 16, 2024

For Dawn / mach-gpu, we follow Dawn's API definitions (webgpu.h and dawn.json) which have Buffer.BindingLayout.type's default value as undefined. https://github.com/hexops/dawn/blob/generated-2023-08-10.1691685418/dawn.json#L276

For sysgpu we will document the defaults better, but for Dawn / mach-gpu this is as intended

@silversquirl
Copy link
Contributor Author

Are Dawn's defaults not simply the zero-values? Zero-values are ofc the "default" in a C API, but a Zig API shouldn't necessarily mirror that.
I'd argue it's much better to use the WebGPU spec's defaults, as those are more carefully considered and thus make more sense.

I guess that'd turn this into a feature request rather than a bug :)

@slimsag slimsag changed the title gpu: Default values of BindingLayout structs don't match WebGPU spec sysgpu: provide clear default values instead of WebGPU 'undefined' default values Mar 6, 2024
@slimsag
Copy link
Member

slimsag commented Mar 6, 2024

Are Dawn's defaults not simply the zero-values? Zero-values are ofc the "default" in a C API

yeah, that's undefined (which is an enum name assigned zero value in basically every case)

I guess that'd turn this into a feature request rather than a bug :)

I agree, I'll update the title

@slimsag slimsag added sysgpu and removed needs-triage Issues that need triaging labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sysgpu
Projects
None yet
Development

No branches or pull requests

2 participants