Skip to content

aco: remove pack_half_2x16(a, 0) optimization

This makes the compiler less predictable and should only have a very small effect on performance.

fossil-db (Vega):

Totals from 2410 (1.79% of 134756) affected shaders:
CodeSize: 6911568 -> 6942840 (+0.45%)

Fixes Horizon Zero Dawn artifacts.

If a shader has:

a = pack_half_2x16(a, 0) //rtne
store(pack_half_2x16(0, b) | a) //rtne
a = unpack_2x16(a).x

It will become:

store(pack_half_2x16(a, b)) //rtz
a = unpack_2x16(pack_half_2x16(a, 0)).x //rtne

So a later shader with unpack_2x16(load()).x will use a rounded to zero, while the previous shader will use a rounded to the nearest even.

Merge request reports