blob: 9172b59bcc2e43cc8e44a28f585188658e81b38b [file] [log] [blame]
Tobin Ehlis5ade0692016-10-05 17:18:15 -06001#!/usr/bin/python3 -i
2
3import sys
4import xml.etree.ElementTree as etree
5import urllib2
Tobin Ehlis5ade0692016-10-05 17:18:15 -06006
7#############################
8# spec.py script
9#
10# Overview - this script is intended to generate validation error codes and message strings from the xhtml version of
11# the specification. In addition to generating the header file, it provides a number of corrollary services to aid in
12# generating/updating the header.
13#
14# Ideal flow - Not there currently, but the ideal flow for this script would be that you run the script, it pulls the
15# latest spec, compares it to the current set of generated error codes, and makes any updates as needed
16#
17# Current flow - the current flow acheives all of the ideal flow goals, but with more steps than are desired
18# 1. Get the spec - right now spec has to be manually generated or pulled from the web
19# 2. Generate header from spec - This is done in a single command line
20# 3. Generate database file from spec - Can be done along with step #2 above, the database file contains a list of
21# all error enums and message strings, along with some other info on if those errors are implemented/tested
22# 4. Update header using a given database file as the root and a new spec file as goal - This makes sure that existing
23# errors keep the same enum identifier while also making sure that new errors get a unique_id that continues on
24# from the end of the previous highest unique_id.
25#
26# TODO:
27# 1. Improve string matching to add more automation for figuring out which messages are changed vs. completely new
28#
29#
30#############################
31
32
33spec_filename = "vkspec.html" # can override w/ '-spec <filename>' option
34out_filename = "vk_validation_error_messages.h" # can override w/ '-out <filename>' option
35db_filename = "vk_validation_error_database.txt" # can override w/ '-gendb <filename>' option
36gen_db = False # set to True when '-gendb <filename>' option provided
37spec_compare = False # set to True with '-compare <db_filename>' option
38# This is the root spec link that is used in error messages to point users to spec sections
Tobin Ehlisbd0a9c62016-10-14 18:06:16 -060039#old_spec_url = "https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html"
40spec_url = "https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html"
Tobin Ehlis5ade0692016-10-05 17:18:15 -060041# After the custom validation error message, this is the prefix for the standard message that includes the
42# spec valid usage language as well as the link to nearest section of spec to that language
43error_msg_prefix = "For more information refer to Vulkan Spec Section "
44ns = {'ns': 'http://www.w3.org/1999/xhtml'}
Mark Lobodzinski629d47b2016-10-18 13:34:58 -060045validation_error_enum_name = "VALIDATION_ERROR_"
Tobin Ehlis5ade0692016-10-05 17:18:15 -060046# Dict of new enum values that should be forced to remap to old handles, explicitly set by -remap option
47remap_dict = {}
48
49def printHelp():
50 print "Usage: python spec.py [-spec <specfile.html>] [-out <headerfile.h>] [-gendb <databasefile.txt>] [-compare <databasefile.txt>] [-update] [-remap <new_id-old_id,count>] [-help]"
51 print "\n Default script behavior is to parse the specfile and generate a header of unique error enums and corresponding error messages based on the specfile.\n"
52 print " Default specfile is from online at %s" % (spec_url)
53 print " Default headerfile is %s" % (out_filename)
54 print " Default databasefile is %s" % (db_filename)
55 print "\nIf '-gendb' option is specified then a database file is generated to default file or <databasefile.txt> if supplied. The database file stores"
56 print " the list of enums and their error messages."
57 print "\nIf '-compare' option is specified then the given database file will be read in as the baseline for generating the new specfile"
58 print "\nIf '-update' option is specified this triggers the master flow to automate updating header and database files using default db file as baseline"
59 print " and online spec file as the latest. The default header and database files will be updated in-place for review and commit to the git repo."
60 print "\nIf '-remap' option is specified it supplies forced remapping from new enum ids to old enum ids. This should only be specified along with -update"
61 print " option. Starting at newid and remapping to oldid, count ids will be remapped. Default count is '1' and use ':' to specify multiple remappings."
62
63class Specification:
64 def __init__(self):
65 self.tree = None
66 self.val_error_dict = {} # string for enum is key that references text for output message
67 self.error_db_dict = {} # dict of previous error values read in from database file
68 self.delimiter = '~^~' # delimiter for db file
69 self.copyright = """/* THIS FILE IS GENERATED. DO NOT EDIT. */
70
71/*
72 * Vulkan
73 *
74 * Copyright (c) 2016 Google Inc.
Mark Lobodzinski629d47b2016-10-18 13:34:58 -060075 * Copyright (c) 2016 LunarG, Inc.
Tobin Ehlis5ade0692016-10-05 17:18:15 -060076 *
77 * Licensed under the Apache License, Version 2.0 (the "License");
78 * you may not use this file except in compliance with the License.
79 * You may obtain a copy of the License at
80 *
81 * http://www.apache.org/licenses/LICENSE-2.0
82 *
83 * Unless required by applicable law or agreed to in writing, software
84 * distributed under the License is distributed on an "AS IS" BASIS,
85 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
86 * See the License for the specific language governing permissions and
87 * limitations under the License.
88 *
89 * Author: Tobin Ehlis <tobine@google.com>
90 */"""
91 def _checkInternetSpec(self):
92 """Verify that we can access the spec online"""
93 try:
94 online = urllib2.urlopen(spec_url,timeout=1)
95 return True
96 except urllib2.URLError as err:
97 return False
98 return False
99 def loadFile(self, online=True, spec_file=spec_filename):
100 """Load an API registry XML file into a Registry object and parse it"""
101 # Check if spec URL is available
102 if (online and self._checkInternetSpec()):
103 print "Using spec from online at %s" % (spec_url)
104 self.tree = etree.parse(urllib2.urlopen(spec_url))
105 else:
106 print "Using local spec %s" % (spec_file)
107 self.tree = etree.parse(spec_file)
108 #self.tree.write("tree_output.xhtml")
109 #self.tree = etree.parse("tree_output.xhtml")
110 self.parseTree()
111 def updateDict(self, updated_dict):
112 """Assign internal dict to use updated_dict"""
113 self.val_error_dict = updated_dict
114 def parseTree(self):
115 """Parse the registry Element, once created"""
116 print "Parsing spec file..."
117 valid_usage = False # are we under a valid usage branch?
118 unique_enum_id = 0
119 self.root = self.tree.getroot()
120 #print "ROOT: %s" % self.root
121 prev_heading = '' # Last seen section heading or sub-heading
122 prev_link = '' # Last seen link id within the spec
123 for tag in self.root.iter(): # iterate down tree
124 # Grab most recent section heading and link
125 if tag.tag in ['{http://www.w3.org/1999/xhtml}h2', '{http://www.w3.org/1999/xhtml}h3']:
126 if tag.get('class') != 'title':
127 continue
128 #print "Found heading %s" % (tag.tag)
129 prev_heading = "".join(tag.itertext())
130 # Insert a space between heading number & title
131 sh_list = prev_heading.rsplit('.', 1)
132 prev_heading = '. '.join(sh_list)
133 prev_link = tag[0].get('id')
134 #print "Set prev_heading %s to have link of %s" % (prev_heading.encode("ascii", "ignore"), prev_link.encode("ascii", "ignore"))
135 elif tag.tag == '{http://www.w3.org/1999/xhtml}a': # grab any intermediate links
136 if tag.get('id') != None:
137 prev_link = tag.get('id')
138 #print "Updated prev link to %s" % (prev_link)
139 elif tag.tag == '{http://www.w3.org/1999/xhtml}strong': # identify valid usage sections
140 if None != tag.text and 'Valid Usage' in tag.text:
141 valid_usage = True
142 else:
143 valid_usage = False
144 elif tag.tag == '{http://www.w3.org/1999/xhtml}li' and valid_usage: # grab actual valid usage requirements
145 error_msg_str = "%s '%s' which states '%s' (%s#%s)" % (error_msg_prefix, prev_heading, "".join(tag.itertext()).replace('\n', ''), spec_url, prev_link)
146 # Some txt has multiple spaces so split on whitespace and join w/ single space
147 error_msg_str = " ".join(error_msg_str.split())
Mark Lobodzinski629d47b2016-10-18 13:34:58 -0600148 enum_str = "%s%05d" % (validation_error_enum_name, unique_enum_id)
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600149 # TODO : '\' chars in spec error messages are most likely bad spec txt that needs to be updated
150 self.val_error_dict[enum_str] = error_msg_str.encode("ascii", "ignore").replace("\\", "/")
151 unique_enum_id = unique_enum_id + 1
152 #print "dict contents: %s:" % (self.val_error_dict)
153 #print "Added enum to dict: %s" % (enum_str.encode("ascii", "ignore"))
154 #print "Validation Error Dict has a total of %d unique errors and contents are:\n%s" % (unique_enum_id, self.val_error_dict)
155 def genHeader(self, header_file):
156 """Generate a header file based on the contents of a parsed spec"""
157 print "Generating header %s..." % (header_file)
158 file_contents = []
159 file_contents.append(self.copyright)
160 file_contents.append('\n#pragma once')
Tobin Ehlisbf98b692016-10-06 12:58:06 -0600161 file_contents.append('#include <unordered_map>')
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600162 file_contents.append('\n// enum values for unique validation error codes')
163 file_contents.append('// Corresponding validation error message for each enum is given in the mapping table below')
164 file_contents.append('// When a given error occurs, these enum values should be passed to the as the messageCode')
165 file_contents.append('// parameter to the PFN_vkDebugReportCallbackEXT function')
166 enum_decl = ['enum UNIQUE_VALIDATION_ERROR_CODE {']
Tobin Ehlisbf98b692016-10-06 12:58:06 -0600167 error_string_map = ['static std::unordered_map<int, char const *const> validation_error_map{']
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600168 for enum in sorted(self.val_error_dict):
169 #print "Header enum is %s" % (enum)
170 enum_decl.append(' %s = %d,' % (enum, int(enum.split('_')[-1])))
171 error_string_map.append(' {%s, "%s"},' % (enum, self.val_error_dict[enum]))
Mark Lobodzinski629d47b2016-10-18 13:34:58 -0600172 enum_decl.append(' %sMAX_ENUM = %d,' % (validation_error_enum_name, int(enum.split('_')[-1]) + 1))
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600173 enum_decl.append('};')
174 error_string_map.append('};')
175 file_contents.extend(enum_decl)
176 file_contents.append('\n// Mapping from unique validation error enum to the corresponding error message')
177 file_contents.append('// The error message should be appended to the end of a custom error message that is passed')
178 file_contents.append('// as the pMessage parameter to the PFN_vkDebugReportCallbackEXT function')
179 file_contents.extend(error_string_map)
180 #print "File contents: %s" % (file_contents)
181 with open(header_file, "w") as outfile:
182 outfile.write("\n".join(file_contents))
183 def analyze(self):
184 """Print out some stats on the valid usage dict"""
185 # Create dict for # of occurences of identical strings
186 str_count_dict = {}
187 unique_id_count = 0
188 for enum in self.val_error_dict:
189 err_str = self.val_error_dict[enum]
190 if err_str in str_count_dict:
191 #print "Found repeat error string"
192 str_count_dict[err_str] = str_count_dict[err_str] + 1
193 else:
194 str_count_dict[err_str] = 1
195 unique_id_count = unique_id_count + 1
196 print "Processed %d unique_ids" % (unique_id_count)
197 repeat_string = 0
198 for es in str_count_dict:
199 if str_count_dict[es] > 1:
200 repeat_string = repeat_string + 1
201 #print "String '%s' repeated %d times" % (es, repeat_string)
202 print "Found %d repeat strings" % (repeat_string)
203 def genDB(self, db_file):
204 """Generate a database of check_enum, check_coded?, testname, error_string"""
205 db_lines = []
206 # Write header for database file
207 db_lines.append("# This is a database file with validation error check information")
208 db_lines.append("# Comments are denoted with '#' char")
209 db_lines.append("# The format of the lines is:")
210 db_lines.append("# <error_enum>%s<check_implemented>%s<testname>%s<errormsg>" % (self.delimiter, self.delimiter, self.delimiter))
Mark Lobodzinski629d47b2016-10-18 13:34:58 -0600211 db_lines.append("# error_enum: Unique error enum for this check of format %s<uniqueid>" % validation_error_enum_name)
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600212 db_lines.append("# check_implemented: 'Y' if check has been implemented in layers, 'U' for unknown, or 'N' for not implemented")
213 db_lines.append("# testname: Name of validation test for this check, 'Unknown' for unknown, or 'None' if not implmented")
214 db_lines.append("# errormsg: The unique error message for this check that includes spec language and link")
215 for enum in sorted(self.val_error_dict):
216 # Default to unknown if check or test are implemented, then update below if appropriate
217 implemented = 'U'
218 testname = 'Unknown'
219 # If we have an existing db entry for this enum, use its implemented/testname values
220 if enum in self.error_db_dict:
221 implemented = self.error_db_dict[enum]['check_implemented']
222 testname = self.error_db_dict[enum]['testname']
223 #print "delimiter: %s, id: %s, str: %s" % (self.delimiter, enum, self.val_error_dict[enum])
224 # No existing entry so default to N for implemented and None for testname
225 db_lines.append("%s%s%s%s%s%s%s" % (enum, self.delimiter, implemented, self.delimiter, testname, self.delimiter, self.val_error_dict[enum]))
226 print "Generating database file %s" % (db_file)
227 with open(db_file, "w") as outfile:
228 outfile.write("\n".join(db_lines))
229 def readDB(self, db_file):
230 """Read a db file into a dict, format of each line is <enum><implemented Y|N?><testname><errormsg>"""
231 db_dict = {} # This is a simple db of just enum->errormsg, the same as is created from spec
232 max_id = 0
233 with open(db_file, "r") as infile:
234 for line in infile:
235 if line.startswith('#'):
236 continue
237 line = line.strip()
238 db_line = line.split(self.delimiter)
Tobin Ehlis802b16e2016-10-11 09:37:19 -0600239 if len(db_line) != 4:
240 print "ERROR: Bad database line doesn't have 4 elements: %s" % (line)
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600241 error_enum = db_line[0]
242 implemented = db_line[1]
243 testname = db_line[2]
244 error_str = db_line[3]
245 db_dict[error_enum] = error_str
246 # Also read complete database contents into our class var for later use
247 self.error_db_dict[error_enum] = {}
248 self.error_db_dict[error_enum]['check_implemented'] = implemented
249 self.error_db_dict[error_enum]['testname'] = testname
250 self.error_db_dict[error_enum]['error_string'] = error_str
251 unique_id = int(db_line[0].split('_')[-1])
252 if unique_id > max_id:
253 max_id = unique_id
254 return (db_dict, max_id)
255 # Compare unique ids from original database to data generated from updated spec
256 # 1. If a new id and error code exactly match original, great
257 # 2. If new id is not in original, but exact error code is, need to use original error code
258 # 3. If new id and new error are not in original, make sure new id picks up from end of original list
259 # 4. If new id in original, but error strings don't match then:
260 # 4a. If error string has exact match in original, update new to use original
261 # 4b. If error string not in original, may be updated error message, manually address
262 def compareDB(self, orig_db_dict, max_id):
263 """Compare orig database dict to new dict, report out findings, and return potential new dict for parsed spec"""
264 # First create reverse dicts of err_strings to IDs
265 next_id = max_id + 1
266 orig_err_to_id_dict = {}
267 # Create an updated dict in-place that will be assigned to self.val_error_dict when done
268 updated_val_error_dict = {}
269 for enum in orig_db_dict:
270 orig_err_to_id_dict[orig_db_dict[enum]] = enum
271 new_err_to_id_dict = {}
272 for enum in self.val_error_dict:
273 new_err_to_id_dict[self.val_error_dict[enum]] = enum
274 ids_parsed = 0
275 # Now parse through new dict and figure out what to do with non-matching things
276 for enum in sorted(self.val_error_dict):
277 ids_parsed = ids_parsed + 1
278 enum_list = enum.split('_') # grab sections of enum for use below
Tobin Ehlisbd0a9c62016-10-14 18:06:16 -0600279 # Any user-forced remap takes precendence
280 if enum_list[-1] in remap_dict:
281 enum_list[-1] = remap_dict[enum_list[-1]]
282 new_enum = "_".join(enum_list)
283 print "NOTE: Using user-supplied remap to force %s to be %s" % (enum, new_enum)
284 updated_val_error_dict[new_enum] = self.val_error_dict[enum]
285 elif enum in orig_db_dict:
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600286 if self.val_error_dict[enum] == orig_db_dict[enum]:
Tobin Ehlisbd0a9c62016-10-14 18:06:16 -0600287 print "Exact match for enum %s" % (enum)
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600288 # Nothing to see here
289 if enum in updated_val_error_dict:
290 print "ERROR: About to overwrite entry for %s" % (enum)
291 updated_val_error_dict[enum] = self.val_error_dict[enum]
292 elif self.val_error_dict[enum] in orig_err_to_id_dict:
293 # Same value w/ different error id, need to anchor to original id
Tobin Ehlisbd0a9c62016-10-14 18:06:16 -0600294 print "Need to switch new id %s to original id %s" % (enum, orig_err_to_id_dict[self.val_error_dict[enum]])
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600295 # Update id at end of new enum to be same id from original enum
296 enum_list[-1] = orig_err_to_id_dict[self.val_error_dict[enum]].split('_')[-1]
297 new_enum = "_".join(enum_list)
298 if new_enum in updated_val_error_dict:
299 print "ERROR: About to overwrite entry for %s" % (new_enum)
300 updated_val_error_dict[new_enum] = self.val_error_dict[enum]
301 else:
302 # No error match:
303 # First check if only link has changed, in which case keep ID but update message
304 orig_msg_list = orig_db_dict[enum].split('(', 1)
305 new_msg_list = self.val_error_dict[enum].split('(', 1)
306 if orig_msg_list[0] == new_msg_list[0]: # Msg is same bug link has changed, keep enum & update msg
307 print "NOTE: Found that only spec link changed for %s so keeping same id w/ new link" % (enum)
308 updated_val_error_dict[enum] = self.val_error_dict[enum]
Tobin Ehlisbd0a9c62016-10-14 18:06:16 -0600309 # This seems to be a new error so need to pick it up from end of original unique ids & flag for review
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600310 else:
311 enum_list[-1] = "%05d" % (next_id)
312 new_enum = "_".join(enum_list)
313 next_id = next_id + 1
314 print "MANUALLY VERIFY: Updated new enum %s to be unique %s. Make sure new error msg is actually unique and not just changed" % (enum, new_enum)
315 print " New error string: %s" % (self.val_error_dict[enum])
316 if new_enum in updated_val_error_dict:
317 print "ERROR: About to overwrite entry for %s" % (new_enum)
318 updated_val_error_dict[new_enum] = self.val_error_dict[enum]
319 else: # new enum is not in orig db
320 if self.val_error_dict[enum] in orig_err_to_id_dict:
Tobin Ehlisbd0a9c62016-10-14 18:06:16 -0600321 print "New enum %s not in orig dict, but exact error message matches original unique id %s" % (enum, orig_err_to_id_dict[self.val_error_dict[enum]])
Tobin Ehlis5ade0692016-10-05 17:18:15 -0600322 # Update new unique_id to use original
323 enum_list[-1] = orig_err_to_id_dict[self.val_error_dict[enum]].split('_')[-1]
324 new_enum = "_".join(enum_list)
325 if new_enum in updated_val_error_dict:
326 print "ERROR: About to overwrite entry for %s" % (new_enum)
327 updated_val_error_dict[new_enum] = self.val_error_dict[enum]
328 else:
329 enum_list[-1] = "%05d" % (next_id)
330 new_enum = "_".join(enum_list)
331 next_id = next_id + 1
332 print "Completely new id and error code, update new id from %s to unique %s" % (enum, new_enum)
333 if new_enum in updated_val_error_dict:
334 print "ERROR: About to overwrite entry for %s" % (new_enum)
335 updated_val_error_dict[new_enum] = self.val_error_dict[enum]
336 # Assign parsed dict to be the udpated dict based on db compare
337 print "In compareDB parsed %d entries" % (ids_parsed)
338 return updated_val_error_dict
339 def validateUpdateDict(self, update_dict):
340 """Compare original dict vs. update dict and make sure that all of the checks are still there"""
341 # Currently just make sure that the same # of checks as the original checks are there
342 #orig_ids = {}
343 orig_id_count = len(self.val_error_dict)
344 #update_ids = {}
345 update_id_count = len(update_dict)
346 if orig_id_count != update_id_count:
347 print "Original dict had %d unique_ids, but updated dict has %d!" % (orig_id_count, update_id_count)
348 return False
349 print "Original dict and updated dict both have %d unique_ids. Great!" % (orig_id_count)
350 return True
351 # TODO : include some more analysis
352
353# User passes in arg of form <new_id1>-<old_id1>[,count1]:<new_id2>-<old_id2>[,count2]:...
354# new_id# = the new enum id that was assigned to an error
355# old_id# = the previous enum id that was assigned to the same error
356# [,count#] = The number of ids to remap starting at new_id#=old_id# and ending at new_id[#+count#-1]=old_id[#+count#-1]
357# If not supplied, then ,1 is assumed, which will only update a single id
358def updateRemapDict(remap_string):
359 """Set up global remap_dict based on user input"""
360 remap_list = remap_string.split(":")
361 for rmap in remap_list:
362 count = 1 # Default count if none supplied
363 id_count_list = rmap.split(',')
364 if len(id_count_list) > 1:
365 count = int(id_count_list[1])
366 new_old_id_list = id_count_list[0].split('-')
367 for offset in range(count):
368 remap_dict["%05d" % (int(new_old_id_list[0]) + offset)] = "%05d" % (int(new_old_id_list[1]) + offset)
369 for new_id in sorted(remap_dict):
370 print "Set to remap new id %s to old id %s" % (new_id, remap_dict[new_id])
371
372if __name__ == "__main__":
373 i = 1
374 use_online = True # Attempt to grab spec from online by default
375 update_option = False
376 while (i < len(sys.argv)):
377 arg = sys.argv[i]
378 i = i + 1
379 if (arg == '-spec'):
380 spec_filename = sys.argv[i]
381 # If user specifies local specfile, skip online
382 use_online = False
383 i = i + 1
384 elif (arg == '-out'):
385 out_filename = sys.argv[i]
386 i = i + 1
387 elif (arg == '-gendb'):
388 gen_db = True
389 # Set filename if supplied, else use default
390 if i < len(sys.argv) and not sys.argv[i].startswith('-'):
391 db_filename = sys.argv[i]
392 i = i + 1
393 elif (arg == '-compare'):
394 db_filename = sys.argv[i]
395 spec_compare = True
396 i = i + 1
397 elif (arg == '-update'):
398 update_option = True
399 spec_compare = True
400 gen_db = True
401 elif (arg == '-remap'):
402 updateRemapDict(sys.argv[i])
403 i = i + 1
404 elif (arg in ['-help', '-h']):
405 printHelp()
406 sys.exit()
407 if len(remap_dict) > 1 and not update_option:
408 print "ERROR: '-remap' option can only be used along with '-update' option. Exiting."
409 sys.exit()
410 spec = Specification()
411 spec.loadFile(use_online, spec_filename)
412 #spec.parseTree()
413 #spec.genHeader(out_filename)
414 spec.analyze()
415 if (spec_compare):
416 # Read in old spec info from db file
417 (orig_db_dict, max_id) = spec.readDB(db_filename)
418 # New spec data should already be read into self.val_error_dict
419 updated_dict = spec.compareDB(orig_db_dict, max_id)
420 update_valid = spec.validateUpdateDict(updated_dict)
421 if update_valid:
422 spec.updateDict(updated_dict)
423 else:
424 sys.exit()
425 if (gen_db):
426 spec.genDB(db_filename)
427 print "Writing out file (-out) to '%s'" % (out_filename)
428 spec.genHeader(out_filename)
429
430##### Example dataset
431# <div class="sidebar">
432# <div class="titlepage">
433# <div>
434# <div>
435# <p class="title">
436# <strong>Valid Usage</strong> # When we get to this guy, we know we're under interesting sidebar
437# </p>
438# </div>
439# </div>
440# </div>
441# <div class="itemizedlist">
442# <ul class="itemizedlist" style="list-style-type: disc; ">
443# <li class="listitem">
444# <em class="parameter">
445# <code>device</code>
446# </em>
447# <span class="normative">must</span> be a valid
448# <code class="code">VkDevice</code> handle
449# </li>
450# <li class="listitem">
451# <em class="parameter">
452# <code>commandPool</code>
453# </em>
454# <span class="normative">must</span> be a valid
455# <code class="code">VkCommandPool</code> handle
456# </li>
457# <li class="listitem">
458# <em class="parameter">
459# <code>flags</code>
460# </em>
461# <span class="normative">must</span> be a valid combination of
462# <code class="code">
463# <a class="link" href="#VkCommandPoolResetFlagBits">VkCommandPoolResetFlagBits</a>
464# </code> values
465# </li>
466# <li class="listitem">
467# <em class="parameter">
468# <code>commandPool</code>
469# </em>
470# <span class="normative">must</span> have been created, allocated, or retrieved from
471# <em class="parameter">
472# <code>device</code>
473# </em>
474# </li>
475# <li class="listitem">All
476# <code class="code">VkCommandBuffer</code>
477# objects allocated from
478# <em class="parameter">
479# <code>commandPool</code>
480# </em>
481# <span class="normative">must</span> not currently be pending execution
482# </li>
483# </ul>
484# </div>
485# </div>
486##### Second example dataset
487# <div class="sidebar">
488# <div class="titlepage">
489# <div>
490# <div>
491# <p class="title">
492# <strong>Valid Usage</strong>
493# </p>
494# </div>
495# </div>
496# </div>
497# <div class="itemizedlist">
498# <ul class="itemizedlist" style="list-style-type: disc; ">
499# <li class="listitem">The <em class="parameter"><code>queueFamilyIndex</code></em> member of any given element of <em class="parameter"><code>pQueueCreateInfos</code></em> <span class="normative">must</span> be unique within <em class="parameter"><code>pQueueCreateInfos</code></em>
500# </li>
501# </ul>
502# </div>
503# </div>
504# <div class="sidebar">
505# <div class="titlepage">
506# <div>
507# <div>
508# <p class="title">
509# <strong>Valid Usage (Implicit)</strong>
510# </p>
511# </div>
512# </div>
513# </div>
514# <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
515#<em class="parameter"><code>sType</code></em> <span class="normative">must</span> be <code class="code">VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO</code>
516#</li><li class="listitem">
517#<em class="parameter"><code>pNext</code></em> <span class="normative">must</span> be <code class="literal">NULL</code>
518#</li><li class="listitem">
519#<em class="parameter"><code>flags</code></em> <span class="normative">must</span> be <code class="literal">0</code>
520#</li><li class="listitem">
521#<em class="parameter"><code>pQueueCreateInfos</code></em> <span class="normative">must</span> be a pointer to an array of <em class="parameter"><code>queueCreateInfoCount</code></em> valid <code class="code">VkDeviceQueueCreateInfo</code> structures
522#</li>