Open msiglreith opened 7 years ago
Currently only support C-like enums or consisting of unit types. SPIR-V (shader) doesn't support union types (afaik), so we probably will use a simple struct layout for emulating it:
enum Foo { A(u32), B(f32), C, }
would be translated to
struct FooA(u32); struct FooB(u32); enum FooTy { A, B, C }; struct Foo { ty: FooTy, a: FooA, b: FooB, }
This will need alot more memory than an corresponding enum, so complex enum types should be avoided.
Keep the current state and disallow complex enum types, but add special handling for Option<T>.
Option<T>
Partially supported now (type construction and tag field assignment) Requires struct construction
Currently only support C-like enums or consisting of unit types. SPIR-V (shader) doesn't support union types (afaik), so we probably will use a simple struct layout for emulating it:
would be translated to
This will need alot more memory than an corresponding enum, so complex enum types should be avoided.
Alternative
Keep the current state and disallow complex enum types, but add special handling for
Option<T>
.