Skip to content

r300: fuse ROUND and ARL to ARR

Pavel Ondračka requested to merge ondracka/mesa:r300_nine_ARR into main

ttn will traslate ARR it gets from nine to fround and f2i32 combo. We now lower the fround (which we can't do natively except when its actually the ARR) and later the f2i32 will get translated to ftrunc, because nir can't figure out that we already have integer value as the lowered round pattern is not recognized. So we end with completely unnecessary fround + ftrunc (which lowered amount to 9 instructions).

Luckily, round is only GLSL 1.30+, so it seems we can assume that every fround we see actually comes from lowered ARR and can thus be fused later, so do this in the backend and also disable the nir fround lowering. This could in theory break if shader open-codes fround (for example godot shaders do this) and nir is smart enough to see through it and fuse it to fround again, but that does not seem to be the case right now.

This fixes significant instruction increase in vertex shaders (over 10% in some circumstances) with nine and ttn->ntt as opposed to the direct TGSI route.

No shader-db changes on RV530.

Merge request reports