webgpu.h
is designed to be an extensible and forward-compatible API. The following types of extensions are supported:
("Prefix" is the name of the implementation that owns the extension, if any; see below.)
When an application is running against an unknown webgpu.h
implementation, extension support may be detected at runtime as follows:
NULL
for unknown function names.)The following design principles should be followed to ensure future extensibility:
Force32 = 0x7FFFFFFF
value to force them to be 32-bit (and have a stable ABI representation).nextInChain
), or at least be associated with some struct (e.g. child, sibling, or parent) that is extensible.Note also:
2
or implementation-specific version of an existing method or type can be added.Implementation-specific extensions should use the naming conventions listed above, with the name prefixes listed here.
Implementation-specific extensions must use their assigned block when adding new values to existing enum types. (Implementation-specific enum types do not need to use these blocks since they are exclusive to one implementation.)
If an implementation does not have an assigned prefix and block, it should be added to this registry.
Prefix | Enum Block | Description | |
---|---|---|---|
Standard | (none) | 0x0000_???? | Extensions standardized in webgpu.h |
Compatibility Mode | TBD | 0x0002_???? | Special: implementations that don't support Compatibility Mode must ignore any chained structs with WGPUSType values in this block, instead of erroring. This block must only be used for Compat additions that can be ignored without affecting the semantics of a non-erroring program. |
wgpu-native | Wgpu | 0x0003_???? | - |
Emscripten | Emscripten | 0x0004_???? | - |
Dawn | Dawn | 0x0005_???? | - |
Note all negative values (values with the most-significant bit set to 1) are reserved for future use.
Implementation-specific extensions must choose one of the following options when adding new bitflag values:
Core and Compatibility Mode bits will always be in the least-significant 53 bits, because the JS API can only represent 53 bits. Therefore, extended bitflag values should be in the most-significant 11 bits, overflowing into the most-significant end of the least-significant 53 bits if necessary (or avoiding doing so by adding a new bitflag type entirely).