r600g: Fix special negative immediate constants when using ABS modifier.
authorIvan Kalvachev <ikalvachev@gmail.com>
Sat, 24 Oct 2015 22:16:58 +0000 (01:16 +0300)
committerNicolai Hähnle <nhaehnle@gmail.com>
Thu, 29 Oct 2015 22:56:57 +0000 (23:56 +0100)
commitf75f21a24ae2dd83507f3d4d8007f0fcfe6db802
tree23fc8518acc02f0fbce31c68d60e86ed4f3a05fa
parent24c90888aeaf90b13700389b91b74bf63ee9f28d
r600g: Fix special negative immediate constants when using ABS modifier.

Some constants (like 1.0 and 0.5) could be inlined as immediate inputs
without using their literal value. The r600_bytecode_special_constants()
function emulates the negative of these constants by using NEG modifier.

However some shaders define -1.0 constant and want to use it as 1.0.
They do so by using ABS modifier. But r600_bytecode_special_constants()
set NEG in addition to ABS. Since NEG modifier have priority over ABS one,
we get -|1.0| as result, instead of |1.0|.

The patch simply prevents the additional switching of NEG when ABS is set.

[According to Ivan Kalvachev, this bug was fond via
https://github.com/iXit/Mesa-3D/issues/126 and
https://github.com/iXit/Mesa-3D/issues/127]

Signed-off-by: Ivan Kalvachev <ikalvachev@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
CC: <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/r600/r600_asm.c
src/gallium/drivers/r600/r600_asm.h
src/gallium/drivers/r600/r600_shader.c