gpu: adopt new dawn.json policy for optionality of slice fields, default zero values

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-11 03:44:34 -07:00 committed by Stephen Gutekanst
parent 2b354f9226
commit 726bdf3fba
13 changed files with 40 additions and 63 deletions

View file

@ -140,11 +140,10 @@ We make the following quality of life improvements.
TODO: explain it
### Nullability
### Optionality & nullability
* `label: ?[*:0]const u8` fields have a default `null` value added to them.
* Where a struct has a slice `_count` field, with an optional pointer, if the `_count` field defaults to zero we also enforce the optional pointer defaults to `null`. Specifically we do this for:
* `next_in_chain: *const ChainedStruct` fields, which enable optional implementation-specific extensions to the WebGPU API, default to `null`.
* Optional values default to their zero value (either `null` or a struct constructor `.{}`) when specified as `optional` in `dawn.json`. This means things like `label`, `next_in_chain`, etc. do not need to be specified.
* Fields representing a slice with a `_count` field are nullable pointers defaulting to null and 0 by default.
### Slice helpers