Skip to content

INIT macro follow-up tasks #427

Closed
Closed
@kainino0x

Description

@kainino0x

Follow-ups collected from PR #422 (issue #158).

Checkbox = fixed or at least has a PR or issue about it.

  • Fix default for buffer binding type #445
  • (EDIT: big one so I added it at the top) Proposal: enums in INIT macros always use Undefined #446
    Maybe INIT macros should prefer Undefined over trivial defaults (e.g. /*.dimension=*/WGPUTextureDimension_2D), in case the JS API changes them from trivial (WebIDL) defaults to non-trivial defaults (non-breakingly for JS, in such a way that they depend on the values of other new members or something, but that would make the INIT macros differ slightly).
    (I am not sure if we ever discussed this before. I know we said that we should implement all of WebIDL's trivial defaulting in webgpu.h implementations though.)
  • Are we happy with #define WGPU_DEPTH_CLEAR_VALUE_UNDEFINED (NAN) (requires including math.h). Note the JS API disallows NaN (and Infinity) at the WebIDL level
  • Make sure we have the default we want for WGPUCallbackMode (I can't remember if we wanted to default it or not. Does it even matter since people are probably usually going to use these inline anyway? Maybe they don't need INIT macros?)
    Default *CallbackInfo.mode to zero (invalid) instead of WaitAnyOnly #471
  • Should we have INIT macros for output-only structs? (like WGPUAdapterInfo)
    • Maybe we can guarantee these are all zero-init?
  • Should we have INIT macros when they are equivalent to zero-init, and therefore not really necessary? (see also Abbreviate all-zero INIT macros as {0}? #423)
    • Could be auto-detected or just explicit in the YAML
  • Should we name all of the enums' zero values so that the INIT values can be more self-documenting (instead of using _wgpu_ENUM_ZERO_INIT() or whatever)?
    • (we also initialize booleans to 0 but there isn't really a better option for those)
  • "Defaults to" sounds kind of like the defaulting occurs inside the API. This is not always true (though it is true for some fields). What we are actually documenting is what the value of the field is when you use the INIT macro.
    Clarify "Defaults to" generated doc #436
  • Make sure INIT macros are properly postfixed when defining extension (see Fix inconsistent management of ExtSuffix in INIT macros #453)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions