From: Alyssa Rosenzweig Date: Fri, 21 Aug 2020 20:21:40 +0000 (-0400) Subject: panfrost: Inherit default values from structs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a36ac2b9b058228e3c0a4180536838924c504985;p=mesa.git panfrost: Inherit default values from structs Nesting can be useful sometimes. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- diff --git a/src/panfrost/lib/gen_pack.py b/src/panfrost/lib/gen_pack.py index 59890f7cd8a..8c1f2e755cd 100644 --- a/src/panfrost/lib/gen_pack.py +++ b/src/panfrost/lib/gen_pack.py @@ -539,9 +539,10 @@ class Parser(object): for field in self.group.fields: if not type(field) is Field: continue - if field.default == None: - continue - default_fields.append(" .{} = {}".format(field.name, field.default)) + if field.default is not None: + default_fields.append(" .{} = {}".format(field.name, field.default)) + elif field.type in self.structs: + default_fields.append(" .{} = {{ {}_header }}".format(field.name, self.gen_prefix(safe_name(field.type.upper())))) print('#define %-40s\\' % (name + '_header')) print(", \\\n".join(default_fields))