Skip to content

glsl: change vec3 packing order

Mali4x0 prefers vec3 to be aligned to power of 2, if vec3s are packed after vec1 it may end up in .yzw components and it will result in extra mov (and precision loss for coordinates) since Mali4x0 doesn't have a swizzle in load input instruction.

So let's pack vec3s after vec4. As result vec4 will take whole slot, vec3 will be aligned at the beginning of the slot, vec2 will take half a slot (and aligned to .xy or .zw), and vec1 will populate the rest.

shader-db diff:

total instructions in shared programs: 15750 -> 15696 (-0.34%)
instructions in affected programs: 1383 -> 1329 (-3.90%)
helped: 23
HURT: 10

total spills in shared programs: 139 -> 142 (2.16%)
spills in affected programs: 2 -> 5 (150.00%)
helped: 0
HURT: 1

total fills in shared programs: 604 -> 611 (1.16%)
fills in affected programs: 7 -> 14 (100.00%)
helped: 0
HURT: 1

Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com

Edited by Vasily Khoruzhick

Merge request reports