sealed class Tinman.Gpu.Semantic.OrderAttribute

Derived from

Attribute abstract

Controls the order of fields in constant buffers structures and in stage input / output structures.

When GPU code is generated, the fields of a structure are sorted in descending order by the element count of their base type (i.e. the element type for arrays) and then in ascending order by their declaration name:

  1. float4x4 (16 elements)

  2. float3x4 (12 elements)

  3. float3x3 (9 elements)

  4. float4, int4 (4 elements)

  5. float2x2 (4 elements)

  6. float3, int3 (3 elements)

  7. float2, int2 (2 elements)

  8. float, int, bool (1 element)

Additionally, the Order may be used to group structure fields: then the default sorting (see above) is applied separately to each group and the groups are output in ascending order. This can be used to fine-tune data alignment in order to achieve better packing. Fields without an Order belong to an implicit group which is always output last.

Public / Constructors


public constructor OrderAttribute → (1)

order in : int32

See Order.

Creates a new instance of Order.

Public / Attributes


public readonly attribute Order → (int32)

The order value.

Constant buffer fields are grouped by their order value and the groups are output in ascending of their value.