From a36ac2b9b058228e3c0a4180536838924c504985 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 21 Aug 2020 16:21:40 -0400 Subject: [PATCH] panfrost: Inherit default values from structs Nesting can be useful sometimes. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/panfrost/lib/gen_pack.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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)) -- 2.30.2