lima: Fix alpha blending
authorAndreas Baierl <ichgeh@imkreisrum.de>
Wed, 15 Jan 2020 14:31:39 +0000 (15:31 +0100)
committerAndreas Baierl <ichgeh@imkreisrum.de>
Thu, 16 Jan 2020 16:43:41 +0000 (16:43 +0000)
commit2ebfc6db16137b16663bf563c32fe1932917b22c
treeb480d00402b456c9a9b0e0e8c15d49851555ef8c
parent3bca0af25dbf6d6b162463138100abb20bc1a1cc
lima: Fix alpha blending

Introduce separate helper functions to set the blendfactor bits.

Lima uses bits 0-2 for the type, bit 3 sets the inverted function
and bit 4 is set if alpha is used.
alpha_src_factor and alpha_dst_factor don't need the alpha bit, so
they are masked with 0xf. There is only place for 4 bits anyway.
If alpha_src_factor is PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE, we need
to change it to PIPE_BLENDFACTOR_ONE first.
This is exactly what the blob does and we pass all
dEQP-GLES2.functional.fragment_ops.blend.* tests now.
Better than the blob btw...

Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3411>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3411>
src/gallium/drivers/lima/lima_draw.c