etnaviv: tgsi: Fix gl_FrontFacing support
authorMarek Vasut <marex@denx.de>
Sun, 17 Nov 2019 13:53:54 +0000 (14:53 +0100)
committerMarek Vasut <marex@denx.de>
Sat, 21 Dec 2019 19:17:27 +0000 (20:17 +0100)
commit45e1443fd87b23edb00019a743a6bba38ae846b2
tree06f2f4089917d4cb785e625cbcdc7d8a1287a282
parent63b33120b7ae2598d4cacfa5e5b95476d0295acd
etnaviv: tgsi: Fix gl_FrontFacing support

The GPU presents the state of the hardware front_face in internal
register 0 (i0), the range of which is 0.0f..1.0f.

This patch assigns the fragment shader input to this internal register.
Moreover, based on the internal front_ccw state, the value of the i0
register is inverted accordingly using SET.EQ/SEQ.NE instruction before
being further processed in the shader. This mimics the operation of the
NIR compiler.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2868>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2868>
src/gallium/drivers/etnaviv/etnaviv_compiler_tgsi.c