nv50/ir: fix ConstantFolding with saturation
authorKarol Herbst <karolherbst@gmail.com>
Sun, 30 Jul 2017 15:51:22 +0000 (17:51 +0200)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 9 Aug 2017 14:25:26 +0000 (10:25 -0400)
commit24a799ad35a824fba94062f9b018f603717ed145
treebe402e7cc07cafd5f3d9a423641728e55b5e2544
parentcc43c4a9e56a5f6dd66e6e67074c219e6f87ba26
nv50/ir: fix ConstantFolding with saturation

For mul(a, +-1) codegen can generate OP_MOV with a saturation flag
set which is ignored at emission. The same can happen with add(a, 0),
and others.

Adding an assert for detecting more of such issues.

Fixes wrongly rendered water in Hitman Absolution running under wine.
Also a few shaders in Mad Max and Alien Isolation produce such MOVs.

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Reviewed-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
[imirkin: generalize the fix for other cases]
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp