7
7
import urllib
8
8
import xml .etree .ElementTree as etree
9
9
import urllib .request
10
+ import zlib
10
11
11
12
cmdversions = {
12
13
"vkCmdSetDiscardRectangleEnableEXT" : 2 ,
@@ -157,12 +158,17 @@ def cdepends(key):
157
158
for key in block_keys :
158
159
blocks [key ] = ''
159
160
161
+ devp = {}
162
+
160
163
for (group , cmdnames ) in command_groups .items ():
161
164
ifdef = '#if ' + group + '\n '
162
165
163
166
for key in block_keys :
164
167
blocks [key ] += ifdef
165
168
169
+ devt = 0
170
+ devo = len (blocks ['DEVICE_TABLE' ])
171
+
166
172
for name in sorted (cmdnames ):
167
173
cmd = commands [name ]
168
174
type = cmd .findtext ('param[1]/type' )
@@ -176,6 +182,7 @@ def cdepends(key):
176
182
blocks ['LOAD_DEVICE' ] += '\t ' + name + ' = (PFN_' + name + ')load(context, "' + name + '");\n '
177
183
blocks ['DEVICE_TABLE' ] += '\t PFN_' + name + ' ' + name + ';\n '
178
184
blocks ['LOAD_DEVICE_TABLE' ] += '\t table->' + name + ' = (PFN_' + name + ')load(context, "' + name + '");\n '
185
+ devt += 1
179
186
elif is_descendant_type (types , type , 'VkInstance' ):
180
187
blocks ['LOAD_INSTANCE' ] += '\t ' + name + ' = (PFN_' + name + ')load(context, "' + name + '");\n '
181
188
elif type != '' :
@@ -187,6 +194,14 @@ def cdepends(key):
187
194
for key in block_keys :
188
195
if blocks [key ].endswith (ifdef ):
189
196
blocks [key ] = blocks [key ][:- len (ifdef )]
197
+ elif key == 'DEVICE_TABLE' :
198
+ devh = zlib .crc32 (blocks [key ][devo :].encode ())
199
+ assert (devh not in devp )
200
+ devp [devh ] = True
201
+
202
+ blocks [key ] += '#else\n '
203
+ blocks [key ] += f'\t PFN_vkVoidFunction padding_{ devh :x} [{ devt } ];\n '
204
+ blocks [key ] += '#endif /* ' + group + ' */\n '
190
205
else :
191
206
blocks [key ] += '#endif /* ' + group + ' */\n '
192
207
0 commit comments