asahi: Allow GenXML to be used in C++

C++ requires explicit casts from integers to enums. Fixes errors like
the following when trying to use Asahi GenXML from a GTest unit test.

src/asahi/lib/agx_pack.h:554:23: error: assigning to 'enum agx_channels' from incompatible type 'uint64_t' (aka 'unsigned long long')
   values->channels = __gen_unpack_uint(cl, 0, 6);

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14903>
This commit is contained in:
Alyssa Rosenzweig
2022-02-06 15:02:26 -05:00
committed by Marge Bot
parent 055c5a59f8
commit db93090ffc
+3
View File
@@ -511,6 +511,9 @@ class Group(object):
if field.modifier[0] == "log2":
prefix = "1 << "
if field.type in self.parser.enums:
prefix = f"(enum {enum_name(field.type)}) {prefix}"
decoded = '{}{}({}){}'.format(prefix, convert, ', '.join(args), suffix)
print(' values->{} = {};'.format(fieldref.path, decoded))