mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 07:00:12 +01:00
panfrost: gen_pack: Allow empty structs
This is useful if we want to declare padding sections which can be packed (filled with zeros) and unpacked (checked for non zero entries). Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6797>
This commit is contained in:
parent
c7a10193d4
commit
1b27817f17
1 changed files with 4 additions and 2 deletions
|
|
@ -345,7 +345,7 @@ class Group(object):
|
|||
|
||||
def get_length(self):
|
||||
# Determine number of bytes in this group.
|
||||
calculated = max(field.end // 8 for field in self.fields) + 1
|
||||
calculated = max(field.end // 8 for field in self.fields) + 1 if len(self.fields) > 0 else 0
|
||||
if self.length > 0:
|
||||
assert(self.length >= calculated)
|
||||
else:
|
||||
|
|
@ -662,8 +662,10 @@ class Parser(object):
|
|||
print('#define %-40s\\' % (name + '_header'))
|
||||
if default_fields:
|
||||
print(", \\\n".join(default_fields))
|
||||
else:
|
||||
elif len(self.group.fields) > 0:
|
||||
print(' 0')
|
||||
else:
|
||||
print(' ')
|
||||
print('')
|
||||
|
||||
def emit_template_struct(self, name, group, opaque_structs):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue