You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be supplanted by other features, but it would be helpful to have some form of basic enum syntax to declare integer constants. A very basic strawman is below:
enum BlendMode {
Normal = 1,
Add,
Subtract,
Multiply,
Overlay,
HardLight,
};
struct BlendParams {
blend_mode: BlendMode, // the same size as a u32,
};
Alternatively, if we had support for user namespaces, we could use const statements to declare u32 variables inside a namespace; this loses the ability to have enums as a separate "type" that can be embedded in structs and passed to functions, but it would be OK to start with.
The text was updated successfully, but these errors were encountered:
I guess my only question right now is we would need to know the size of the enum. u32 would be fine, if we want to limit the values to u32. Or u32 by default unless the enum uses values exceeding 2^32 - 1 or contains values < 0
u32 is the standard lingua franca of GPUs, and I would suggest starting with that as a default; if you want to add support for extending other types, I would be OK with syntax a la enum BlendMode : i8 or something like that. Having the type implicitly decided by value range is a classic C++ footgun that requires people to add MaxValueRange = 0xFFFFFFFF, to all enums to force the size.
This might be supplanted by other features, but it would be helpful to have some form of basic enum syntax to declare integer constants. A very basic strawman is below:
Alternatively, if we had support for user namespaces, we could use const statements to declare u32 variables inside a namespace; this loses the ability to have enums as a separate "type" that can be embedded in structs and passed to functions, but it would be OK to start with.
The text was updated successfully, but these errors were encountered: