Skip to content

glsl: Fix precision of type conversions.

Emma Anholt requested to merge anholt/mesa:glsl-u2f-precision into main

We can't make the conversion result mediump just because its args were mediump -- the change in base type breaks the chain of precision inference based on operand precision in expressions. The result may get assigned to mediump anyway, at which point NIR will be happy to eat up the (for example) f2f16(u2f32(x)) and turn it into u2f16(x).

The effect on android shaders on freedreno is modest, as expected:

total instructions in shared programs: 2722982 -> 2722680 (-0.01%)
instructions in affected programs: 26471 -> 26169 (-1.14%)

Fixes: #8124 (llvmpipe webgl conformance in shaderop.unary_operator.pre_decrement_effect)

Merge request reports