GLSL types

Constraints:

  • No recursive composition: Vector and Swizzle are not the same class.

  • Function argument template deduction: Vector and swizzles have base classes that are of the same template (partial specialization).

  • Standard layout: No common class in the vector and swizzle inheritance hierarchies.

  • Shared operators: Vector and swizzle share a template partial specialization.

  • constexpr: Vector and swizzle shared template partial specialization takes CRTP.

  • Slicing: Vector and swizzle shared template partial specialization is not easily expressed (to avoid accidentally taking it as an argument and slicing)

Final layout: