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

Open
opened 2024-02-12 20:28:52 +00:00 by silversquirl · 3 comments
silversquirl commented 2024-02-12 20:28:52 +00:00 (Migrated from github.com)

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 :)

eg. the default value for the `type` field of `Buffer.BindingLayout` should be `uniform`, [according to the WebGPU spec](https://gpuweb.github.io/gpuweb/#dictdef-gpubufferbindinglayout). 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 :)
emidoots commented 2024-02-16 03:03:52 +00:00 (Migrated from github.com)

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

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 commented 2024-02-18 18:06:24 +00:00 (Migrated from github.com)

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 :)

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 :)
emidoots commented 2024-03-06 18:24:51 +00:00 (Migrated from github.com)

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

> 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
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#1159
No description provided.