This came up in WebAssembly/wasi-gfx#71 (comment)
where WebGpu has a C definition:
https://github.com/webgpu-native/webgpu-headers/blob/bf8ddb91dc38ea11ec1b727dae1fa965c4207d22/webgpu.h#L1334
/**
* `Red | Green | Blue | Alpha`.
*/
static const WGPUColorWriteMask WGPUColorWriteMask_All = 0x000000000000000F;
the generated WIT in WebAssembly/wasi-gfx#71 as of writing is:
flags gpu-color-write {
red,
green,
blue,
alpha,
all,
}
which is incorrect in that all shouldn't be a new flag, just a shorthand for a combination of all the other flags.
I think WIT should be changed to allow expressing named flag values that are just combinations of zero or more existing flags by allowing assigning flag values to either 0 or the bitwise or of one or more other named flags:
flags colors {
black = 0,
red,
green,
yellow = red | green,
blue,
magenta = red | blue,
purple = magenta,
cyan = green | blue,
white = red | green | blue,
}
This came up in WebAssembly/wasi-gfx#71 (comment)
where WebGpu has a C definition:
https://github.com/webgpu-native/webgpu-headers/blob/bf8ddb91dc38ea11ec1b727dae1fa965c4207d22/webgpu.h#L1334
the generated WIT in WebAssembly/wasi-gfx#71 as of writing is:
which is incorrect in that
allshouldn't be a new flag, just a shorthand for a combination of all the other flags.I think WIT should be changed to allow expressing named flag values that are just combinations of zero or more existing flags by allowing assigning flag values to either
0or the bitwise or of one or more other named flags: