UniformLayout

sg_uniform_layout

A hint for the interior memory layout of uniform blocks. This is only relevant for the GL backend where the internal layout of uniform blocks must be known to sokol-gfx. For all other backends the internal memory layout of uniform blocks doesn't matter, sokol-gfx will just pass uniform data as a single memory blob to the 3D backend.

SG_UNIFORMLAYOUT_NATIVE (default) Native layout means that a 'backend-native' memory layout is used. For the GL backend this means that uniforms are packed tightly in memory (e.g. there are no padding bytes).

SG_UNIFORMLAYOUT_STD140 The memory layout is a subset of std140. Arrays are only allowed for the FLOAT4, INT4 and MAT4. Alignment is as is as follows:

FLOAT, INT: 4 byte alignment FLOAT2, INT2: 8 byte alignment FLOAT3, INT3: 16 byte alignment(!) FLOAT4, INT4: 16 byte alignment MAT4: 16 byte alignment FLOAT4[], INT4[]: 16 byte alignment

The overall size of the uniform block must be a multiple of 16.

For more information search for 'UNIFORM DATA LAYOUT' in the documentation block at the start of the header

Values

ValueMeaning
Default
Native
Std140
Num

Meta