freedreno: Fix or/and'ing two BitmaskEnums
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 17 Mar 2023 14:11:53 +0000 (15:11 +0100)
committerMarge Bot <emma+marge@anholt.net>
Sat, 1 Apr 2023 13:53:31 +0000 (13:53 +0000)
commitb123ee707d8051fba2727fae72acceb3f1bdf65e
tree54f9029285eb7928164dd8d6890b3e4b2e41ffd0
parent5825f9dd68eca28894a4cbca7796669514a81f44
freedreno: Fix or/and'ing two BitmaskEnums

Previously when there was an & or | with two BitmaskEnums, the compiler
would try to cast the RHS and find a matching overload, but there were
many different casts (to the enum itself, to an integer, to a boolean,
etc.) each with a matching overload which meant that it couldn't pick
one and errored out due to an ambiguous overload. Fix this by
explicitly providing an overload that takes a BitmaskEnum on the RHS.
It has to also provide a BitmaskEnum output, so that subsequent
operators with the result on the LHS (e.g. when or'ing together three
BitmaskEnums without any parentheses tricks) also get the right
overload.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22224>
src/freedreno/common/freedreno_common.h