summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-02-10 21:42:56 -0800
committerKristian Høgsberg Kristensen <[email protected]>2016-02-10 22:36:38 -0800
commit2009e304f7c0bdf5bf01b8dd60dddc2f8bb25f18 (patch)
tree30541bd18d6e892a0e2d90a48c94cfced288e97e
parentf710f3ca377a4583b1fc5081cc28ee1d4aba71cb (diff)
anv/pack: Handle case where a struct field covers multiple dwords
We also didn't add start to field.end to get the absolute field end position.
-rwxr-xr-xsrc/vulkan/gen_pack_header.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/vulkan/gen_pack_header.py b/src/vulkan/gen_pack_header.py
index 8ed74581063..fa2eed7a9ab 100755
--- a/src/vulkan/gen_pack_header.py
+++ b/src/vulkan/gen_pack_header.py
@@ -317,13 +317,16 @@ class Group:
# assert dwords[index].address == None
dwords[index].address = field
- # Does this field extend into the next dword?
- if index < field.end // 32 and dwords[index].size == 32:
- if index + 1 in dwords:
- assert dwords[index + 1].size == 32
+ # Coalesce all the dwords covered by this field. The two cases we
+ # handle are where multiple fields are in a 64 bit word (typically
+ # and address and a few bits) or where a single struct field
+ # completely covers multiple dwords.
+ while index < (start + field.end) // 32:
+ if index + 1 in dwords and not dwords[index] == dwords[index + 1]:
dwords[index].fields.extend(dwords[index + 1].fields)
dwords[index].size = 64
dwords[index + 1] = dwords[index]
+ index = index + 1
def emit_pack_function(self, start):
dwords = {}