diff options
Diffstat (limited to 'codegen/vulkan/scripts/Retired')
-rwxr-xr-x | codegen/vulkan/scripts/Retired/checkLinks.py | 353 | ||||
-rw-r--r-- | codegen/vulkan/scripts/Retired/extensionStubSource.py | 327 | ||||
-rwxr-xr-x | codegen/vulkan/scripts/Retired/findBalance.py | 162 | ||||
-rwxr-xr-x | codegen/vulkan/scripts/Retired/fixupRef.py | 202 | ||||
-rwxr-xr-x | codegen/vulkan/scripts/Retired/insertTags.py | 102 | ||||
-rwxr-xr-x | codegen/vulkan/scripts/Retired/realign.py | 48 | ||||
-rw-r--r-- | codegen/vulkan/scripts/Retired/refDesc.py | 356 |
7 files changed, 1550 insertions, 0 deletions
diff --git a/codegen/vulkan/scripts/Retired/checkLinks.py b/codegen/vulkan/scripts/Retired/checkLinks.py new file mode 100755 index 00000000..35103a80 --- /dev/null +++ b/codegen/vulkan/scripts/Retired/checkLinks.py @@ -0,0 +1,353 @@ +#!/usr/bin/python3 +# +# Copyright 2015-2021 The Khronos Group Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# checkLinks.py - validate link/reference API constructs in files +# +# Usage: checkLinks.py [options] files > logfile +# +# Options: +# -follow attempt to follow include:: directives. This script isn't # an +# Asciidoctor processor, so only literal relative paths can # be followed. +# -info print some internal diagnostics. +# -paramcheck attempt to validate param: names against the surrounding +# context (the current structure/function being validated, for example). +# This generates many false positives, so is not enabled by default. +# -fatal unvalidatable links cause immediate error exit from the script. +# Otherwise, errors are accumulated and summarized at the end. +# +# Depends on vkapi.py, which is a Python representation of relevant parts +# of the Vulkan API. Only works when vkapi.py is generated for the full +# API, e.g. 'makeAllExts checklinks'; otherwise many false-flagged errors +# will occur. + +import copy, os, pdb, re, string, sys +from vkapi import * + +global curFile, curLine, sectionDepth +global errCount, warnCount, emittedPrefix, printInfo + +curFile = '???' +curLine = -1 +sectionDepth = 0 +emittedPrefix = {} +printInfo = False + +# Called before printing a warning or error. Only prints once prior +# to output for a given file. +def emitPrefix(): + global curFile, curLine, emittedPrefix + if (curFile not in emittedPrefix.keys()): + emittedPrefix[curFile] = None + print('Checking file:', curFile) + print('-------------------------------') + +def info(*args, **kwargs): + global curFile, curLine, printInfo + if (printInfo): + + emitPrefix() + print('INFO: %s line %d:' % (curFile, curLine), + ' '.join([str(arg) for arg in args])) + +# Print a validation warning found in a file +def warning(*args, **kwargs): + global curFile, curLine, warnCount + + warnCount = warnCount + 1 + emitPrefix() + print('WARNING: %s line %d:' % (curFile, curLine), + ' '.join([str(arg) for arg in args])) + +# Print a validation error found in a file +def error(*args, **kwargs): + global curFile, curLine, errCount + + errCount = errCount + 1 + emitPrefix() + print('ERROR: %s line %d:' % (curFile, curLine), + ' '.join([str(arg) for arg in args])) + +# See if a tag value exists in the specified dictionary and +# suggest it as an alternative if so. +def checkTag(tag, value, dict, dictName, tagName): + if (value in dict.keys()): + warning(value, 'exists in the API but not as a', + tag + ': .', 'Try using the', tagName + ': tag.') + +# Report an error due to an asciidoc tag which doesn't match +# a corresponding API entity. +def foundError(errType, tag, value, fatal): + global curFile, curLine + error('no such', errType, tag + ':' + value) + # Try some heuristics to detect likely problems such as missing vk + # prefixes or the wrong tag. + + # Look in all the dictionaries in vkapi.py to see if the tag + # is just wrong but the API entity actually exists. + checkTag(tag, value, flags, 'flags', 'tlink/tname') + checkTag(tag, value, enums, 'enums', 'elink') + checkTag(tag, value, structs, 'structs', 'slink/sname') + checkTag(tag, value, handles, 'handles', 'slink/sname') + checkTag(tag, value, defines, 'defines', 'slink/sname') + checkTag(tag, value, consts, 'consts', 'ename') + checkTag(tag, value, protos, 'protos', 'flink/fname') + checkTag(tag, value, funcpointers, 'funcpointers', 'tlink/tname') + + # Look for missing vk prefixes (quirky since it's case-dependent) + # NOT DONE YET + + if fatal: + print('ERROR: %s line %d:' % (curFile, curLine), + ' '.join(['no such', errType, tag + ':' + value]), file=sys.stderr) + sys.exit(1) + +# Look for param in the list of all parameters of the specified functions +# Returns True if found, False otherwise +def findParam(param, funclist): + for f in funclist: + if (param in protos[f]): + info('parameter:', param, 'found in function:', f) + return True + return False + +# Initialize tracking state for checking links/includes +def initChecks(): + global curFile, curLine, curFuncs, curStruct, accumFunc, sectionDepth + global errCount, warnCount + global incPat, linkPat, pathPat, sectionPat + + # Matches asciidoc single-line section tags + sectionPat = re.compile('^(=+) ') + + # Matches any asciidoc include:: directive + pathPat = re.compile('^include::([\w./_]+)\[\]') + + # Matches asciidoc include:: directives used in spec/ref pages (and also + # others such as validity). This is specific to the layout of the api/ + # includes and allows any path precding 'api/' followed by the category + # (protos, structs, enums, etc.) followed by the name of the proto, + # struct, etc. file. + incPat = re.compile('^.*api/(\w+)/(\w+)\.txt') + + # Lists of current /protos/ (functions) and /structs/ includes. There + # can be several protos contiguously for different forms of a command + curFuncs = [] + curStruct = None + + # Tag if we should accumulate funcs or start a new list. Any intervening + # pname: tags or struct includes will restart the list. + accumFunc = False + + # Matches all link names in the current spec/man pages. Assumes these + # macro names are not trailing subsets of other macros. Used to + # precede the regexp with [^A-Za-z], but this didn't catch macros + # at start of line. + linkPat = re.compile('([efpst](name|link)):(\w*)') + + # Total error/warning counters + errCount = 0 + warnCount = 0 + +# Validate asciidoc internal links in specified file. +# infile - filename to validate +# follow - if True, recursively follow include:: directives +# paramCheck - if True, try to verify pname: refers to valid +# parameter/member names. This generates many false flags currently +# included - if True, function was called recursively +# fatalExit - if True, validation errors cause an error exit immediately +# Links checked are: +# fname:vkBlah - Vulkan command name (generates internal link) +# flink:vkBlah - Vulkan command name +# sname:VkBlah - Vulkan struct name (generates internal link) +# slink:VkBlah - Vulkan struct name +# elink:VkEnumName - Vulkan enumeration ('enum') type name (generates internal link) +# ename:VK_BLAH - Vulkan enumerant token name +# pname:name - parameter name to a command or a struct member +# tlink:name - Other Vulkan type name (generates internal link) +# tname:name - Other Vulkan type name +def checkLinks(infile, follow = False, paramCheck = True, included = False, fatalExit = False): + global curFile, curLine, curFuncs, curStruct, accumFunc, sectionDepth + global errCount, warnCount + global incPat, linkPat, pathPat, sectionPat + + # Global state which gets saved and restored by this function + oldCurFile = curFile + oldCurLine = curLine + curFile = infile + curLine = 0 + + # N.b. dirname() returns an empty string for a path with no directories, + # unlike the shell dirname(1). + if (not os.path.exists(curFile)): + error('No such file', curFile, '- skipping check') + # Restore global state before exiting the function + curFile = oldCurFile + curLine = oldCurLine + return + + inPath = os.path.dirname(curFile) + fp = open(curFile, 'r', encoding='utf-8') + + for line in fp: + curLine = curLine + 1 + + # Track changes up and down section headers, and forget + # the current functions/structure when popping up a level + match = sectionPat.search(line) + if (match): + info('Match sectionPat for line:', line) + depth = len(match.group(1)) + if (depth < sectionDepth): + info('Resetting current function/structure for section:', line) + curFuncs = [] + curStruct = None + sectionDepth = depth + + match = pathPat.search(line) + if (match): + incpath = match.group(1) + info('Match pathPat for line:', line) + info(' incpath =', incpath) + # An include:: directive. First check if it looks like a + # function or struct include file, and modify the corresponding + # current function or struct state accordingly. + match = incPat.search(incpath) + if (match): + info('Match incPat for line:', line) + # For prototypes, if it is preceded by + # another include:: directive with no intervening link: tags, + # add to the current function list. Otherwise start a new list. + # There is only one current structure. + category = match.group(1) + tag = match.group(2) + # @ Validate tag! + # @ Arguably, any intervening text should shift to accumFuncs = False, + # e.g. only back-to-back includes separated by blank lines would be + # accumulated. + if (category == 'protos'): + if (tag in protos.keys()): + if (accumFunc): + curFuncs.append(tag) + else: + curFuncs = [ tag ] + # Restart accumulating functions + accumFunc = True + info('curFuncs =', curFuncs, 'accumFunc =', accumFunc) + else: + error('include of nonexistent function', tag) + elif (category == 'structs'): + if (tag in structs.keys()): + curStruct = tag + # Any /structs/ include means to stop accumulating /protos/ + accumFunc = False + info('curStruct =', curStruct) + else: + error('include of nonexistent struct', tag) + if (follow): + # Actually process the included file now, recursively + newpath = os.path.normpath(os.path.join(inPath, incpath)) + info(curFile, ': including file:', newpath) + checkLinks(newpath, follow, paramCheck, included = True, fatalExit = fatalExit) + + matches = linkPat.findall(line) + for match in matches: + # Start actual validation work. Depending on what the + # asciidoc tag name is, look up the value in the corresponding + # dictionary. + tag = match[0] + value = match[2] + if (tag == 'fname' or tag == 'flink'): + if (value not in protos.keys()): + foundError('function', tag, value, False) + elif (tag == 'sname' or tag == 'slink'): + if (value not in structs.keys() and + value not in handles.keys()): + foundError('aggregate/scalar/handle/define type', tag, value, False) + elif (tag == 'ename'): + if (value not in consts.keys() and value not in defines.keys()): + foundError('enumerant/constant', tag, value, False) + elif (tag == 'elink'): + if (value not in enums.keys() and value not in flags.keys()): + foundError('enum/bitflag type', tag, value, fatalExit) + # tname and tlink are the same except if the errors are treated as fatal + # They can be recombined once both are error-clean + elif (tag == 'tname'): + if (value not in funcpointers.keys() and value not in flags.keys()): + foundError('function pointer/other type', tag, value, fatalExit) + elif (tag == 'tlink'): + if (value not in funcpointers.keys() and value not in flags.keys()): + foundError('function pointer/other type', tag, value, False) + elif (tag == 'pname'): + # Any pname: tag means to stop accumulating /protos/ + accumFunc = False + # See if this parameter is in the current proto(s) and struct + foundParam = False + if (curStruct and value in structs[curStruct]): + info('parameter', value, 'found in struct', curStruct) + elif (curFuncs and findParam(value, curFuncs)): + True + else: + if paramCheck: + warning('parameter', value, 'not found. curStruct =', + curStruct, 'curFuncs =', curFuncs) + else: + # This is a logic error + error('unknown tag', tag + ':' + value) + fp.close() + + if (errCount > 0 or warnCount > 0): + if (not included): + print('Errors found:', errCount, 'Warnings found:', warnCount) + print('') + + if (included): + info('----- returning from:', infile, 'to parent file', '-----') + + # Don't generate any output for files without errors + # else: + # print(curFile + ': No errors found') + + # Restore global state before exiting the function + curFile = oldCurFile + curLine = oldCurLine + +if __name__ == '__main__': + follow = False + paramCheck = False + included = False + fatalExit = False + + totalErrCount = 0 + totalWarnCount = 0 + + if (len(sys.argv) > 1): + for file in sys.argv[1:]: + if (file == '-follow'): + follow = True + elif (file == '-info'): + printInfo = True + elif file == '-paramcheck': + paramCheck = True + elif (file == '-fatal'): + fatalExit = True + else: + initChecks() + checkLinks(file, + follow, + paramCheck = paramCheck, + included = included, + fatalExit = fatalExit) + totalErrCount = totalErrCount + errCount + totalWarnCount = totalWarnCount + warnCount + else: + print('Need arguments: [-follow] [-info] [-paramcheck] [-fatal] infile [infile...]', file=sys.stderr) + + if (totalErrCount > 0 or totalWarnCount > 0): + if (not included): + print('TOTAL Errors found:', totalErrCount, 'Warnings found:', + totalWarnCount) + if totalErrCount > 0: + sys.exit(1) diff --git a/codegen/vulkan/scripts/Retired/extensionStubSource.py b/codegen/vulkan/scripts/Retired/extensionStubSource.py new file mode 100644 index 00000000..b9ff837e --- /dev/null +++ b/codegen/vulkan/scripts/Retired/extensionStubSource.py @@ -0,0 +1,327 @@ +#!/usr/bin/python3 -i +# +# Copyright 2013-2021 The Khronos Group Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +import os,re,sys +from generator import * + +doc = """ +/* +** This target is no longer maintained and supported. +** See README.adoc for discussion. +** +** This is a simple extension loader which provides the implementations for the +** extension prototypes declared in vulkan header. It supports loading extensions either +** for a single instance or a single device. Multiple instances are not yet supported. +** +** To use the loader add vulkan_ext.c to your solution and include <vulkan/vulkan_ext.h>. +** +** If your application is using a single instance, but multiple devices callParam +** +** vkExtInitInstance(instance); +** +** after initializing the instance. This way the extension loader will use the loaders +** trampoline functions to call the correct driver for each call. This method is safe +** if your application might use more than one device at the cost of one additional +** indirection, the dispatch table of each dispatchable object. +** +** If your application uses only a single device it's better to use +** +** vkExtInitDevice(device); +** +** once the device has been initialized. This will resolve the function pointers +** upfront and thus removes one indirection for each call into the driver. This *can* +** result in slightly more performance for calling overhead limited cases. +*/ +""" + +# StubExtGeneratorOptions - subclass of GeneratorOptions. +# +# Adds options used by COutputGenerator objects during C language header +# generation. +# +# Additional members +# prefixText - list of strings to prefix generated header with +# (usually a copyright statement + calling convention macros). +# alignFuncParam - if nonzero and parameters are being put on a +# separate line, align parameter names at the specified column +class StubExtGeneratorOptions(GeneratorOptions): + """Represents options during C interface generation for headers""" + def __init__(self, + filename = None, + directory = '.', + apiname = None, + profile = None, + versions = '.*', + emitversions = '.*', + defaultExtensions = None, + addExtensions = None, + removeExtensions = None, + emitExtensions = None, + sortProcedure = regSortFeatures, + prefixText = "", + alignFuncParam = 0): + GeneratorOptions.__init__(self, filename, directory, apiname, profile, + versions, emitversions, defaultExtensions, + addExtensions, removeExtensions, + emitExtensions, sortProcedure) + self.prefixText = prefixText + self.alignFuncParam = alignFuncParam + +# ExtensionStubSourceOutputGenerator - subclass of OutputGenerator. +# Generates C-language extension wrapper interface sources. +# +# ---- methods ---- +# ExtensionStubSourceOutputGenerator(errFile, warnFile, diagFile) - args as for +# OutputGenerator. Defines additional internal state. +# ---- methods overriding base class ---- +# beginFile(genOpts) +# endFile() +# beginFeature(interface, emit) +# endFeature() +# genType(typeinfo,name) +# genStruct(typeinfo,name) +# genGroup(groupinfo,name) +# genEnum(enuminfo, name) +# genCmd(cmdinfo) +class ExtensionStubSourceOutputGenerator(OutputGenerator): + """Generate specified API interfaces in a specific style, such as a C header""" + # This is an ordered list of sections in the header file. + TYPE_SECTIONS = ['include', 'define', 'basetype', 'handle', 'enum', + 'group', 'bitmask', 'funcpointer', 'struct'] + ALL_SECTIONS = TYPE_SECTIONS + ['commandPointer', 'command'] + def __init__(self, + errFile = sys.stderr, + warnFile = sys.stderr, + diagFile = sys.stdout): + OutputGenerator.__init__(self, errFile, warnFile, diagFile) + # + def beginFile(self, genOpts): + OutputGenerator.beginFile(self, genOpts) + # C-specific + # + # Multiple inclusion protection & C++ wrappers. + + # Internal state - accumulators for function pointers and function + # pointer initializatoin + self.pointers = []; + self.pointerInitializersInstance = []; + self.pointerInitializersDevice = []; + + # + # Write header protection + filename = self.genOpts.directory + '/' + 'vulkan_ext.h' + self.outFileHeader = open(filename, 'w', encoding='utf-8') + + write('#ifndef VULKAN_EXT_H', file=self.outFileHeader) + write('#define VULKAN_EXT_H', file=self.outFileHeader) + write('', file=self.outFileHeader) + write('#ifdef __cplusplus', file=self.outFileHeader) + write('extern "C" {', file=self.outFileHeader) + write('#endif', file=self.outFileHeader) + + # + # User-supplied prefix text, if any (list of strings) + if (genOpts.prefixText): + for s in genOpts.prefixText: + write(s, file=self.outFile) + write(s, file=self.outFileHeader) + + write(doc, file=self.outFileHeader) + + write('#include <vulkan/vulkan.h>', file=self.outFile) + self.newline() + + write('#include <vulkan/vulkan_core.h>', file=self.outFileHeader) + write('', file=self.outFileHeader) + + write('void vkExtInitInstance(VkInstance instance);', file=self.outFileHeader) + write('void vkExtInitDevice(VkDevice device);', file=self.outFileHeader) + write('', file=self.outFileHeader) + + def endFile(self): + for pointer in self.pointers: + write(pointer, file=self.outFile) + + self.newline() + + write('void vkExtInitInstance(VkInstance instance)\n{', file=self.outFile) + for pointerInitializer in self.pointerInitializersInstance: + write(pointerInitializer, file=self.outFile) + write('}', file=self.outFile) + + self.newline() + + write('void vkExtInitDevice(VkDevice device)\n{', file=self.outFile) + for pointerInitializer in self.pointerInitializersDevice: + write(pointerInitializer, file=self.outFile) + write('}', file=self.outFile) + + self.newline() + + #Finish header file + write('#ifdef __cplusplus', file=self.outFileHeader) + write('}', file=self.outFileHeader) + write('#endif', file=self.outFileHeader) + write('', file=self.outFileHeader) + write('#endif', file=self.outFileHeader) + self.outFileHeader.close() + + # Finish processing in superclass + OutputGenerator.endFile(self) + + def beginFeature(self, interface, emit): + # Start processing in superclass + OutputGenerator.beginFeature(self, interface, emit) + + # Accumulate function pointers and function pointer initialization + self.featurePointers = [] + self.featurePointerInitializersInstance = [] + self.featurePointerInitializersDevice = [] + + def endFeature(self): + # Add feature to global list with protectFeature + if (self.emit and self.featurePointers): + if (self.genOpts.protectFeature): + self.pointers.append('#ifdef ' + self.featureName) + self.pointerInitializersInstance.append('#ifdef ' + self.featureName) + self.pointerInitializersDevice.append('#ifdef ' + self.featureName) + + if (self.featureExtraProtect != None): + self.pointers.append('#ifdef ' + self.featureExtraProtect) + self.pointerInitializersInstance.append('#ifndef ' + self.featureName) + self.pointerInitializersDevice.append('#ifndef ' + self.featureName) + + self.pointers += self.featurePointers; + self.pointerInitializersInstance += self.featurePointerInitializersInstance; + self.pointerInitializersDevice += self.featurePointerInitializersDevice; + + if (self.featureExtraProtect != None): + self.pointers.append('#endif /* ' + self.featureExtraProtect + ' */') + self.pointerInitializersInstance.append('#endif /* ' + self.featureExtraProtect + ' */') + self.pointerInitializersDevice.append('#endif /* ' + self.featureExtraProtect + ' */') + if (self.genOpts.protectFeature): + self.pointers.append('#endif /* ' + self.featureName + ' */') + self.pointerInitializersInstance.append('#endif /* ' + self.featureName + ' */') + self.pointerInitializersDevice.append('#endif /* ' + self.featureName + ' */') + + # Finish processing in superclass + OutputGenerator.endFeature(self) + # + # Type generation + def genType(self, typeinfo, name, alias): + pass + + def genStruct(self, typeinfo, typeName, alias): + pass + + def genGroup(self, groupinfo, groupName, alias): + pass + + def genEnum(self, enuminfo, name, alias): + pass + + # + # Command generation + def genCmd(self, cmdinfo, name, alias): + OutputGenerator.genCmd(self, cmdinfo, name, alias) + + # + decls = self.makeStub(cmdinfo.elem) + self.featurePointerInitializersInstance.append(decls[0]) + self.featurePointerInitializersDevice.append(decls[1]) + self.featurePointers.append(decls[2]) + + # + # makeStub - return static declaration for function pointer and initialization of function pointer + # as a two-element list of strings. + # cmd - Element containing a <command> tag + def makeStub(self, cmd): + """Generate a stub function pointer <command> Element""" + proto = cmd.find('proto') + params = cmd.findall('param') + name = cmd.find('name') + + # Begin accumulating prototype and typedef strings + pfnDecl = 'static ' + pfnDecl += noneStr(proto.text) + + # Find the name tag and generate the function pointer and function pointer initialization code + nameTag = proto.find('name') + tail = noneStr(nameTag.tail) + returnType = noneStr(proto.find('type').text) + + type = self.makeFunctionPointerType(nameTag.text, tail) + + # For each child element, if it's a <name> wrap in appropriate + # declaration. Otherwise append its contents and tail con#tents. + stubDecl = '' + for elem in proto: + text = noneStr(elem.text) + tail = noneStr(elem.tail) + if (elem.tag == 'name'): + name = self.makeProtoName(text, tail) + stubDecl += name + else: + stubDecl += text + tail + + pfnName = self.makeFunctionPointerName(nameTag.text, noneStr(tail)); + pfnDecl += type + ' ' + pfnName + ';' + + # Now generate the stub function + pfnDecl += '\n' + + # Now add the parameter declaration list, which is identical + # for prototypes and typedefs. Concatenate all the text from + # a <param> node without the tags. No tree walking required + # since all tags are ignored. + n = len(params) + paramdecl = '(\n' + + pfnCall = '\n{\n ' + ('return ', '')[returnType == 'void'] + pfnName + '(\n' + # Indented parameters + if n > 0: + indentCallParam = '(\n' + indentdecl = '(\n' + for i in range(0,n): + callParam = '' + + paramdecl += self.makeCParamDecl(params[i], self.genOpts.alignFuncParam) + pfnCall += self.makeCCallParam(params[i], self.genOpts.alignFuncParam) + if (i < n - 1): + paramdecl += ',\n' + pfnCall += ',\n' + else: + paramdecl += ')' + pfnCall += '\n );\n' + indentdecl += paramdecl + indentCallParam += pfnCall + else: + indentdecl = '(void);' + + pfnCall += '}\n' + + featureInstance = ' ' + pfnName + ' = ('+type+')vkGetInstanceProcAddr(instance, "' + name + '");' + featureDevice = ' ' + pfnName + ' = ('+type+')vkGetDeviceProcAddr(device, "' + name + '");' + return [featureInstance, featureDevice , pfnDecl + stubDecl + paramdecl + pfnCall] + + # Return function pointer type for given function + def makeFunctionPointerType(self, name, tail): + return 'PFN_' + name + tail + + # Return name of static variable which stores the function pointer for the given function + def makeFunctionPointerName(self, name, tail): + return 'pfn_' + name + tail + + # + # makeCParamDecl - return a string which is an indented, formatted + # declaration for a <param> or <member> block (e.g. function parameter + # or structure/union member). + # param - Element (<param> or <member>) to format + # aligncol - if non-zero, attempt to align the nested <name> element + # at this column + def makeCCallParam(self, param, aligncol): + return ' ' + param.find('name').text + diff --git a/codegen/vulkan/scripts/Retired/findBalance.py b/codegen/vulkan/scripts/Retired/findBalance.py new file mode 100755 index 00000000..2a9efe1f --- /dev/null +++ b/codegen/vulkan/scripts/Retired/findBalance.py @@ -0,0 +1,162 @@ +#!/usr/bin/python3 +# +# Copyright 2016-2021 The Khronos Group Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# fixupRef.py - replace old // refBegin .. // refEnd syntax with new +# open block syntax +# +# Usage: fixupRef.py [-outdir path] [-overwrite] files + +from reflib import * +import argparse, copy, io, os, pdb, re, string, sys + +def prefix(depth): + return ' ' * depth + +openPat = re.compile('^\[open,(?P<attribs>refpage=.*)\]') +ifdefPat = re.compile('^if(n|)def::(?P<condition>.*)\[(?P<text>.*)\]') +endifPat = re.compile('^endif::(?P<condition>.*)\[\]') + +# Look for imbalanced block delimiters and conditionals +# specFile - filename to examine +def findBalance(specFile): + file = loadFile(specFile) + if file == None: + return + + # blocks[] is a stack of nesting constructs, each of which is + # [ '--', line, None ] for a -- delimiter on line + # [ 'ifdef', line, condition] for an ifdef or ifndef on line + blocks = [] + + line = 1 + + for str in file: + blockDepth = len(blocks) + if blockDepth > 0: + thisBlock = blocks[blockDepth-1] + blockType = thisBlock[0] + blockLine = thisBlock[1] + blockCondition = thisBlock[2] + else: + thisBlock = None + blockType = None + blockLine = None + blockCondition = None + + if str.rstrip() == '--': + if (blockDepth > 0 and blockType == '--'): + print(prefix(blockDepth - 1) + + 'Closing -- block opened @', blockLine, + '-> new block depth =', blockDepth - 1) + blocks.pop() + else: + print(prefix(blockDepth) + + 'Opening -- block @', line, + '-> new block depth:', blockDepth + 1) + blocks.append([ '--', line, None ]) + line = line + 1 + continue + + matches = beginPat.search(str) + if matches != None: + # print('Matched [open pattern @', line, ':', str.rstrip()) + line = line + 1 + continue + + matches = ifdefPat.search(str) + if matches != None: + condition = matches.group('condition') + text = matches.group('text') + + if text != '': + print('Matched self-closing if(n)def pattern @', line, + 'condition:', condition, 'text:', text) + else: + print(prefix(blockDepth) + + 'Opening if(n)def block @', line, + '-> new block depth =', blockDepth + 1, + 'condition:', condition) + blocks.append([ 'ifdef', line, condition ]) + + line = line + 1 + continue + + matches = endifPat.search(str) + if matches != None: + condition = matches.group('condition') + + if (blockDepth > 0): + if blockType == 'ifdef': + # Try closing an ifdef/ifndef block + if blockCondition != condition: + print('** WARNING:', specFile, + 'endif @', blockLine, + 'block depth:', blockDepth, + 'condition', condition, + 'does not match ifdef/ifndef @', + blockLine, 'condition', blockCondition) + + print(prefix(blockDepth - 1) + + 'Closing endif block @', line, + '-> new block depth =', blockDepth - 1) + blocks.pop() + elif blockType == '--': + # An overlap! + print('** ERROR:', specFile, 'endif @', line, + 'block depth:', blockDepth, + 'overlaps -- block start @', blockLine) + else: + # Should never get here + print('** ERROR:', specFile, + 'block depth:', blockDepth, + 'unknown open block type:', blockType) + else: + # Unlikely error condition from bad markup + print('** ERROR:', specFile, + 'block depth:', blockDepth, + 'endif @', line, 'with no matching open block') + + line = line + 1 + continue + + line = line + 1 + + blockDepth = len(blocks) + if blockDepth > 0: + print('** ERROR:', specFile, 'still in open block at EOF:', + 'block depth =', blockDepth, + 'block type:', blocks[blockDepth-1][0]) + +if __name__ == '__main__': + global genDict + genDict = {} + + parser = argparse.ArgumentParser() + + parser.add_argument('-diag', action='store', dest='diagFile', + help='Set the diagnostic file') + parser.add_argument('-warn', action='store', dest='warnFile', + help='Set the warning file') + parser.add_argument('-log', action='store', dest='logFile', + help='Set the log file for both diagnostics and warnings') + parser.add_argument('files', metavar='filename', nargs='*', + help='a filename to extract ref pages from') + parser.add_argument('--version', action='version', version='%(prog)s 1.0') + + results = parser.parse_args() + + setLogFile(True, True, results.logFile) + setLogFile(True, False, results.diagFile) + setLogFile(False, True, results.warnFile) + + skipped = set() + for file in results.files: + findBalance(file) + + if len(skipped) > 0: + print('Files containing skipped feature blocks:') + for file in sorted(skipped): + print('\t' + file) diff --git a/codegen/vulkan/scripts/Retired/fixupRef.py b/codegen/vulkan/scripts/Retired/fixupRef.py new file mode 100755 index 00000000..4a9b792a --- /dev/null +++ b/codegen/vulkan/scripts/Retired/fixupRef.py @@ -0,0 +1,202 @@ +#!/usr/bin/python3 +# +# Copyright 2016-2021 The Khronos Group Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# fixupRef.py - replace old // refBegin .. // refEnd syntax with new +# open block syntax +# +# Usage: fixupRef.py [-outdir path] [-overwrite] files + +from reflib import * +from vkapi import * +import argparse, copy, io, os, pdb, re, string, sys + +# Return 'None' for None, the string otherwise +def noneStr(str): + if str == None: + return '(None)' + else: + return str + +# Escape single quotes in a string for asciidoc +def escapeQuote(str): + return str.replace("'", "\'") + +# Start a refpage open block +def openBlock(pi, fp): + if pi.refs != '': + print("[open,refpage='" + pi.name + + "',desc='" + pi.desc + + "',type='" + pi.type + + "',xrefs='" + pi.refs + "']", + file=fp) + else: + print("[open,refpage='" + pi.name + + "',desc='" + pi.desc + + "',type='" + pi.type + "']", + file=fp) + print('--', file=fp) + +# End a refpage open block +def closeBlock(pi, fp): + print('--', file=fp) + # Just for finding block ends while debugging + # print("// end [open,refpage='" + pi.name + "']", file=fp) + +# Replace old // refBegin .. // refEnd references in an asciidoc +# file with open blocks, per # ??? . +# specFile - filename to extract from +# outDir - output directory to write updated file to, if not overwritten +# overwrite - True if the file should be overwritten in place +# skipped - set of filenames containing commands which weren't +# rewritten with open blocks (e.g. enums). Updated in place. +def replaceRef(specFile, outDir, overwrite = False, skipped = set()): + file = loadFile(specFile) + if file == None: + return + + # Save the path to this file for later use in rewriting relative includes + specDir = os.path.dirname(os.path.abspath(specFile)) + + pageMap = findRefs(file) + logDiag(specFile + ': found', len(pageMap.keys()), 'potential pages') + + sys.stderr.flush() + + # Fix up references in pageMap + fixupRefs(pageMap, specFile, file) + + # Map the page info dictionary into a dictionary of actions + # keyed by line number they're performed on/after: + # 'action' : 'begin' or 'end'. What to do on a refBegin or refEnd line + # 'replace': True if this line needs to be replaced + # 'name' : Name of the ref page being defined + # 'desc' : One-line description of the ref page being defined + # 'type' : Type of the ref page being defined, 'structs', 'protos', etc. + # 'refs' : Space-separated string of crossreferenced pages + + actions = { } + + for name in pageMap.keys(): + pi = pageMap[name] + + # Cleanup parameters for output + pi.name = noneStr(pi.name) + pi.desc = escapeQuote(noneStr(pi.desc)) + + if pi.extractPage: + if (file[pi.begin][0:11] == '// refBegin'): + # Replace line + actions[pi.begin] = { + 'action' : 'begin', + 'replace' : True, + 'pageinfo' : pi + } + else: + # Insert line + actions[pi.begin] = { + 'action' : 'begin', + 'replace' : False, + 'pageinfo' : pi + } + + if (file[pi.end][0:9] == '// refEnd'): + # Replace line + actions[pi.end] = { + 'action' : 'end', + 'replace' : True, + 'pageinfo' : pi + } + else: + # Insert line + actions[pi.end] = { + 'action' : 'end', + 'replace' : False, + 'pageinfo' : pi + } + else: + logWarn('Skipping replacement for', pi.name, 'at', specFile, + 'line', pi.begin) + print('Skipping replacement for', pi.name, 'at', specFile, + 'line', pi.begin) + printPageInfo(pi, file) + skipped.add(specFile) + + if overwrite: + pageName = specFile + else: + pageName = outDir + '/' + os.path.basename(specFile) + + fp = open(pageName, 'w', encoding='utf-8') + + line = 0 + for text in file: + if line in actions.keys(): + action = actions[line]['action'] + replace = actions[line]['replace'] + pi = actions[line]['pageinfo'] + + logDiag('ACTION:', action, 'REPLACE:', replace, 'at line', line) + logDiag('PageInfo of action:') + printPageInfo(pi, file) + + if action == 'begin': + openBlock(pi, fp) + if not replace: + print(text, file=fp, end='') + elif action == 'end': + if not replace: + print(text, file=fp, end='') + closeBlock(pi, fp) + else: + print('ERROR: unrecognized action:', action, 'in', + specFile, 'at line', line) + print(text, file=fp, end='') + else: + print(text, file=fp, end='') + line = line + 1 + + fp.close() + + #for line in sorted(actions.keys()): + # action = actions[line] + # print('action at line', line, '\t', + # action[0], action[1], action[2]) + +if __name__ == '__main__': + global genDict + genDict = {} + + parser = argparse.ArgumentParser() + + parser.add_argument('-diag', action='store', dest='diagFile', + help='Set the diagnostic file') + parser.add_argument('-warn', action='store', dest='warnFile', + help='Set the warning file') + parser.add_argument('-log', action='store', dest='logFile', + help='Set the log file for both diagnostics and warnings') + parser.add_argument('-outdir', action='store', dest='outDir', + default='out', + help='Set the base directory in which pages are generated') + parser.add_argument('-overwrite', action='store_true', + help='Overwrite input filenames instead of writing different output filenames') + parser.add_argument('files', metavar='filename', nargs='*', + help='a filename to extract ref pages from') + parser.add_argument('--version', action='version', version='%(prog)s 1.0') + + results = parser.parse_args() + + setLogFile(True, True, results.logFile) + setLogFile(True, False, results.diagFile) + setLogFile(False, True, results.warnFile) + + skipped = set() + for file in results.files: + replaceRef(file, results.outDir, results.overwrite, skipped) + + if len(skipped) > 0: + print('Files containing skipped feature blocks:') + for file in sorted(skipped): + print('\t' + file) diff --git a/codegen/vulkan/scripts/Retired/insertTags.py b/codegen/vulkan/scripts/Retired/insertTags.py new file mode 100755 index 00000000..a8c494c1 --- /dev/null +++ b/codegen/vulkan/scripts/Retired/insertTags.py @@ -0,0 +1,102 @@ +#!/usr/bin/python3 +# +# Copyright 2016-2021 The Khronos Group Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# insertTags.py - insert // refBegin and // refEnd tags in Vulkan +# spec source files. +# +# Usage: insertTags.py output-dir files + +# Short descriptions of ref pages, if not found +from refDesc import * + +# Utility functions +from reflib import * +import copy, os, pdb, re, string, sys + +# Insert informative tags in a spec asciidoc source file +# specFile - filename to add tags to +# baseDir - output directory to generate page in +def insertTags(specFile, baseDir): + file = loadFile(specFile) + if (file == None): + return + pageMap = findRefs(file) + logDiag(specFile + ': found', len(pageMap.keys()), 'potential pages') + + # Fix up references in pageMap + fixupRefs(pageMap, specFile, file) + + # Proceed backwards through the file, inserting + # // refBegin name desc + # lines where they're meaningful + + logDiag('Table of pages found:') + logDiag('---------------------') + for name in pageMap.keys(): + printPageInfo(pageMap[name], file) + + line = len(file) - 1 + while (line >= 0): + # If this is a valid begin line without a description, and a + # description exists in refDesc, add it. + for name in pageMap.keys(): + pi = pageMap[name] + if (pi.begin == line): + if (not name in refDesc.keys()): + if (pi.desc != None): + logDiag('Description already exists, but no refDesc found for', name, 'at', specFile + ':' + str(line)) + else: + if (pi.embed): + logDiag('No refDesc found (this is OK) for embedded', name, 'at', specFile + ':' + str(line)) + else: + logWarn('No refDesc found for', name, 'at', specFile + ':' + str(line)) + continue + + # New or replacement refBegin line, with short description + newLine = '// refBegin ' + name + ' - ' + refDesc[name] + '\n' + + if (pi.desc == None): + logDiag('Adding description for', name, 'at', specFile + ':' + str(line)) + + # If there's already a refBegin on this line, replace it. + # Otherwise, insert one. + if (file[line].find('// refBegin') == 0): + logDiag('Replacing existing refBegin without description for', name, 'at', specFile + ':' + str(line)) + file[line] = newLine + else: + logDiag('Inserting new refBegin at', specFile + ':' + str(line)) + # Add a blank line after the comment if it's new + file.insert(line, newLine) + file.insert(line, '\n') + else: + if (pi.desc[-1] == '.'): + pi.desc = pi.desc[0:-1] + if (pi.desc == refDesc[name]): + logDiag('Not replacing description for', name, 'at', specFile + ':' + str(line), '- MATCHES existing one') + else: + logWarn('Replacing existing refBegin WITH description for', name, 'at', specFile + ':' + str(line)) + file[line] = newLine + # logWarn('\t refDesc: ', refDesc[name]) + # logWarn('\tfile desc: ', pi.desc) + + line = line - 1 + + pageName = baseDir + '/' + os.path.basename(specFile) + logDiag('Creating output file', pageName) + fp = open(pageName, 'w', encoding='utf-8') + fp.writelines(file) + fp.close() + + +if __name__ == '__main__': + logDiag('In main!') + + baseDir = 'man' + follow = False + if (len(sys.argv) > 2): + baseDir = sys.argv[1] + for file in sys.argv[2:]: + insertTags(file, baseDir) diff --git a/codegen/vulkan/scripts/Retired/realign.py b/codegen/vulkan/scripts/Retired/realign.py new file mode 100755 index 00000000..c2780d4c --- /dev/null +++ b/codegen/vulkan/scripts/Retired/realign.py @@ -0,0 +1,48 @@ +#!/usr/bin/python3 +# +# Copyright 2013-2021 The Khronos Group Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# Usage: realign [infile] > outfile +# Used to realign XML tags in the Vulkan registry after it's operated on by +# some other filter, since whitespace inside a tag isn't part of the +# internal representation. + +import copy, sys, string, re + +def realignXML(fp): + patterns = [ + [ r'(^ *\<type .*)(category=[\'"]bitmask[\'"].*)', 58 ], + [ r'(^ *\<enum [bv].*)(name=.*)', 28 ], + [ r'(^ *\<enum [bv].*)(comment=.*)', 85 ] + ] + + # Assemble compiled expressions to match and alignment columns + numpat = len(patterns) + regexp = [ re.compile(patterns[i][0]) for i in range(0,numpat)] + column = [ patterns[i][1] for i in range(0,numpat)] + + lines = fp.readlines() + for line in lines: + emitted = False + for i in range(0,len(patterns)): + match = regexp[i].match(line) + if (match): + if (not emitted): + #print('# While processing line: ' + line, end='') + emitted = True + #print('# matched expression: ' + patterns[i][0]) + #print('# clause 1 = ' + match.group(1)) + #print('# clause 2 = ' + match.group(2)) + line = match.group(1).ljust(column[i]) + match.group(2) + if (emitted): + print(line) + else: + print(line, end='') + +if __name__ == '__main__': + if (len(sys.argv) > 1): + realignXML(open(sys.argv[1], 'r', encoding='utf-8')) + else: + realignXML(sys.stdin) diff --git a/codegen/vulkan/scripts/Retired/refDesc.py b/codegen/vulkan/scripts/Retired/refDesc.py new file mode 100644 index 00000000..be05a4bb --- /dev/null +++ b/codegen/vulkan/scripts/Retired/refDesc.py @@ -0,0 +1,356 @@ +#!/usr/bin/python3 +# +# Copyright 2016-2021 The Khronos Group Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +refDesc = {} + +# These are extracted from the original handwritten ref pages +# This is a one-time measure to inject // refBegin markup into the spec. + +refDesc['vkAcquireNextImageKHR'] = 'Retrieve the index of the next available presentable image' +refDesc['vkAllocateCommandBuffers'] = 'Allocate command buffers from an existing command pool' +refDesc['vkAllocateDescriptorSets'] = 'Allocate one or more descriptor sets' +refDesc['vkAllocateMemory'] = 'Allocate GPU memory' +refDesc['VkAllocationCallbacks'] = 'Structure containing callback function pointers for memory allocation' +refDesc['vkBeginCommandBuffer'] = 'Start recording a command buffer' +refDesc['vkBindBufferMemory'] = 'Bind device memory to a buffer object' +refDesc['vkBindImageMemory'] = 'Bind device memory to an image object' +refDesc['VkBufferCreateFlags'] = 'Buffer object creation flags' +refDesc['VkBufferCreateInfo'] = 'Structure specifying the parameters of a newly created buffer object' +refDesc['VkBufferMemoryBarrier'] = 'Structure specifying the parameters of a buffer memory barrier' +refDesc['VkBufferUsageFlags'] = 'Buffer object usage flags' +refDesc['vkCmdBeginQuery'] = 'Begin a query' +refDesc['vkCmdBeginRenderPass'] = 'Begin a new render pass' +refDesc['vkCmdBindDescriptorSets'] = 'Binds descriptor sets to a command buffer' +refDesc['vkCmdBindIndexBuffer'] = 'Bind an index buffer to a command buffer' +refDesc['vkCmdBindPipeline'] = 'Bind a pipeline object to a command buffer' +refDesc['vkCmdBindVertexBuffers'] = 'Bind vertex buffers to a command buffer' +refDesc['vkCmdBlitImage'] = 'Copy regions of an image, potentially performing format conversion,' +refDesc['vkCmdClearAttachments'] = 'Clear regions within currently bound framebuffer attachments' +refDesc['vkCmdClearColorImage'] = 'Clear regions of a color image' +refDesc['vkCmdClearDepthStencilImage'] = 'Fill regions of a combined depth-stencil image' +refDesc['vkCmdCopyBufferToImage'] = 'Copy data from a buffer into an image' +refDesc['vkCmdCopyBuffer'] = 'Copy data between buffer regions' +refDesc['vkCmdCopyImageToBuffer'] = 'Copy image data into a buffer' +refDesc['vkCmdCopyImage'] = 'Copy data between images' +refDesc['vkCmdCopyQueryPoolResults'] = 'Copy the results of queries in a query pool to a buffer object' +refDesc['vkCmdDispatchIndirect'] = 'Dispatch compute work items using indirect parameters' +refDesc['vkCmdDispatch'] = 'Dispatch compute work items' +refDesc['vkCmdDrawIndexedIndirect'] = 'Perform an indexed indirect draw' +refDesc['vkCmdDrawIndexed'] = 'Issue an indexed draw into a command buffer' +refDesc['vkCmdDrawIndirect'] = 'Issue an indirect draw into a command buffer' +refDesc['vkCmdDraw'] = 'Draw primitives' +refDesc['vkCmdEndQuery'] = 'Ends a query' +refDesc['vkCmdEndRenderPass'] = 'End the current render pass' +refDesc['vkCmdExecuteCommands'] = 'Execute a secondary command buffer from a primary command buffer' +refDesc['vkCmdFillBuffer'] = 'Fill a region of a buffer with a fixed value' +refDesc['vkCmdNextSubpass'] = 'Transition to the next subpass of a render pass' +refDesc['vkCmdPipelineBarrier'] = 'Insert a set of execution and memory barriers' +refDesc['vkCmdPushConstants'] = 'Update the values of push constants' +refDesc['vkCmdResetEvent'] = 'Reset an event object to non-signaled state' +refDesc['vkCmdResetQueryPool'] = 'Reset queries in a query pool' +refDesc['vkCmdResolveImage'] = 'Resolve regions of an image' +refDesc['vkCmdSetBlendConstants'] = 'Set the values of blend constants' +refDesc['vkCmdSetDepthBias'] = 'Set the depth bias dynamic state' +refDesc['vkCmdSetDepthBounds'] = 'Set the depth bounds test values for a command buffer' +refDesc['vkCmdSetEvent'] = 'Set an event object to signaled state' +refDesc['vkCmdSetLineWidth'] = 'Set the dynamic line width state' +refDesc['vkCmdSetScissor'] = 'Set the dynamic scissor rectangles on a command buffer' +refDesc['vkCmdSetStencilCompareMask'] = 'Set the stencil compare mask dynamic state' +refDesc['vkCmdSetStencilReference'] = 'Set the stencil reference dynamic state' +refDesc['vkCmdSetStencilWriteMask'] = 'Set the stencil write mask dynamic state' +refDesc['vkCmdSetViewport'] = 'Set the viewport on a command buffer' +refDesc['vkCmdUpdateBuffer'] = 'Update a buffer\'s contents from host memory' +refDesc['vkCmdWaitEvents'] = 'Wait for one or more events and insert a set of memory' +refDesc['vkCmdWriteTimestamp'] = 'Write a device timestamp into a query object' +refDesc['VkCommandBufferAllocateInfo'] = 'Structure specifying the allocation parameters for command buffer object' +refDesc['vkCreateAndroidSurfaceKHR'] = 'Create a slink:VkSurfaceKHR object for an Android native window' +refDesc['vkCreateBuffer'] = 'Create a new buffer object' +refDesc['vkCreateBufferView'] = 'Create a new buffer view object' +refDesc['vkCreateCommandPool'] = 'Create a new command pool object' +refDesc['vkCreateComputePipelines'] = 'Creates a new compute pipeline object' +refDesc['vkCreateDescriptorPool'] = 'Creates a descriptor pool object' +refDesc['vkCreateDescriptorSetLayout'] = 'Create a new descriptor set layout' +refDesc['vkCreateDevice'] = 'Create a new device instance' +refDesc['vkCreateDisplayModeKHR'] = 'Create a display mode' +refDesc['vkCreateDisplayPlaneSurfaceKHR'] = 'Create a slink:VkSurfaceKHR structure representing a display plane and mode' +refDesc['vkCreateEvent'] = 'Create a new event object' +refDesc['vkCreateFence'] = 'Create a new fence object' +refDesc['vkCreateFramebuffer'] = 'Create a new framebuffer object' +refDesc['vkCreateGraphicsPipelines'] = 'Create graphics pipelines' +refDesc['vkCreateImage'] = 'Create a new image object' +refDesc['vkCreateImageView'] = 'Create an image view from an existing image' +refDesc['vkCreateInstance'] = 'Create a new Vulkan instance' +refDesc['vkCreateMirSurfaceKHR'] = 'Create a slink:VkSurfaceKHR object for a Mir window' +refDesc['vkCreatePipelineCache'] = 'Creates a new pipeline cache' +refDesc['vkCreatePipelineLayout'] = 'Creates a new pipeline layout object' +refDesc['vkCreateQueryPool'] = 'Create a new query pool object' +refDesc['vkCreateRenderPass'] = 'Create a new render pass object' +refDesc['vkCreateSampler'] = 'Create a new sampler object' +refDesc['vkCreateSemaphore'] = 'Create a new queue semaphore object' +refDesc['vkCreateShaderModule'] = 'Creates a new shader module object' +refDesc['vkCreateSharedSwapchainsKHR'] = 'Create multiple swapchains that share presentable images' +refDesc['vkCreateSwapchainKHR'] = 'Create a swapchain' +refDesc['vkCreateWaylandSurfaceKHR'] = 'Create a slink:VkSurfaceKHR object for a Wayland window' +refDesc['vkCreateXcbSurfaceKHR'] = 'Create a slink:VkSurfaceKHR object for a X11 window, using the XCB client-side library' +refDesc['vkCreateXlibSurfaceKHR'] = 'Create a slink:VkSurfaceKHR object for an X11 window, using the Xlib client-side library' +refDesc['VkDescriptorSetAllocateInfo'] = 'Structure specifying the allocation parameters for descriptor sets' +refDesc['VkDescriptorType'] = 'Specifies the type of a descriptor in a descriptor set' +refDesc['vkDestroyBuffer'] = 'Destroy a buffer object' +refDesc['vkDestroyBufferView'] = 'Destroy a buffer view object' +refDesc['vkDestroyCommandPool'] = 'Destroy a command pool object' +refDesc['vkDestroyDescriptorPool'] = 'Destroy a descriptor pool object' +refDesc['vkDestroyDescriptorSetLayout'] = 'Destroy a descriptor set layout object' +refDesc['vkDestroyDevice'] = 'Destroy a logical device' +refDesc['vkDestroyEvent'] = 'Destroy an event object' +refDesc['vkDestroyFence'] = 'Destroy a fence object' +refDesc['vkDestroyFramebuffer'] = 'Destroy a framebuffer object' +refDesc['vkDestroyImage'] = 'Destroy an image object' +refDesc['vkDestroyImageView'] = 'Destroy an image view object' +refDesc['vkDestroyInstance'] = 'Destroy an instance of Vulkan' +refDesc['vkDestroyPipelineCache'] = 'Destroy a pipeline cache object' +refDesc['vkDestroyPipelineLayout'] = 'Destroy a pipeline layout object' +refDesc['vkDestroyPipeline'] = 'Destroy a pipeline object' +refDesc['vkDestroyQueryPool'] = 'Destroy a query pool object' +refDesc['vkDestroyRenderPass'] = 'Destroy a render pass object' +refDesc['vkDestroySampler'] = 'Destroy a sampler object' +refDesc['vkDestroySemaphore'] = 'Destroy a semaphore object' +refDesc['vkDestroyShaderModule'] = 'Destroy a shader module' +refDesc['vkDestroySurfaceKHR'] = 'Destroy a VkSurfaceKHR object' +refDesc['vkDestroySwapchainKHR'] = 'Destroy a swapchain object' +refDesc['vkDeviceWaitIdle'] = 'Wait for a device to become idle' +refDesc['vkEndCommandBuffer'] = 'Finish recording a command buffer' +refDesc['vkEnumerateDeviceExtensionProperties'] = 'Returns properties of available physical device extensions' +refDesc['vkEnumerateDeviceLayerProperties'] = 'Returns properties of available physical device layers' +refDesc['vkEnumerateInstanceExtensionProperties'] = 'Returns up to requested number of global extension properties' +refDesc['vkEnumerateInstanceLayerProperties'] = 'Returns up to requested number of global layer properties' +refDesc['vkEnumeratePhysicalDevices'] = 'Enumerates the physical devices accessible to a Vulkan instance' +refDesc['vkFlushMappedMemoryRanges'] = 'Flush mapped memory ranges' +refDesc['VkFormatFeatureFlags'] = 'Capability flags of a particular format' +refDesc['vkFreeCommandBuffers'] = 'Free command buffers' +refDesc['vkFreeDescriptorSets'] = 'Free one or more descriptor sets' +refDesc['vkFreeMemory'] = 'Free GPU memory' +refDesc['vkGetBufferMemoryRequirements'] = 'Returns the memory requirements for specified Vulkan object' +refDesc['vkGetDeviceMemoryCommitment'] = 'Query the current commitment for a VkDeviceMemory' +refDesc['vkGetDeviceProcAddr'] = 'Return a function pointer for a command' +refDesc['vkGetDeviceQueue'] = 'Get a queue handle from a device' +refDesc['vkGetDisplayModePropertiesKHR'] = 'Query the set of mode properties supported by the display' +refDesc['vkGetDisplayPlaneCapabilitiesKHR'] = 'Query capabilities of a mode and plane combination' +refDesc['vkGetDisplayPlaneSupportedDisplaysKHR'] = 'Query the list of displays a plane supports' +refDesc['vkGetEventStatus'] = 'Retrieve the status of an event object' +refDesc['vkGetFenceStatus'] = 'Return the status of a fence' +refDesc['vkGetImageMemoryRequirements'] = 'Returns the memory requirements for specified Vulkan object' +refDesc['vkGetImageSparseMemoryRequirements'] = 'Query the memory requirements for a sparse image' +refDesc['vkGetImageSubresourceLayout'] = 'Retrieve information about an image subresource' +refDesc['vkGetInstanceProcAddr'] = 'Return a function pointer for a command' +refDesc['vkGetPhysicalDeviceDisplayPlanePropertiesKHR'] = 'Query the plane properties' +refDesc['vkGetPhysicalDeviceDisplayPropertiesKHR'] = 'Query information about the available displays' +refDesc['vkGetPhysicalDeviceFeatures'] = 'Reports capabilities of a physical device' +refDesc['vkGetPhysicalDeviceFormatProperties'] = 'Lists physical device\'s format capabilities' +refDesc['vkGetPhysicalDeviceImageFormatProperties'] = 'Lists physical device\'s image format capabilities' +refDesc['vkGetPhysicalDeviceMemoryProperties'] = 'Reports memory information for the specified physical device' +refDesc['vkGetPhysicalDeviceMirPresentationSupportKHR'] = 'Query physical device for presentation to Mir' +refDesc['vkGetPhysicalDeviceProperties'] = 'Returns properties of a physical device' +refDesc['vkGetPhysicalDeviceQueueFamilyProperties'] = 'Reports properties of the queues of the specified physical device' +refDesc['vkGetPhysicalDeviceSparseImageFormatProperties'] = 'Retrieve properties of an image format applied to sparse images' +refDesc['vkGetPhysicalDeviceSurfaceCapabilitiesKHR'] = 'Query surface capabilities' +refDesc['vkGetPhysicalDeviceSurfaceFormatsKHR'] = 'Query color formats supported by surface' +refDesc['vkGetPhysicalDeviceSurfacePresentModesKHR'] = 'Query supported presentation modes' +refDesc['vkGetPhysicalDeviceSurfaceSupportKHR'] = 'Query if presentation is supported' +refDesc['vkGetPhysicalDeviceWaylandPresentationSupportKHR'] = 'Query physical device for presentation to Wayland' +refDesc['vkGetPhysicalDeviceXcbPresentationSupportKHR'] = 'Query physical device for presentation to X11 server using XCB' +refDesc['vkGetPhysicalDeviceXlibPresentationSupportKHR'] = 'Query physical device for presentation to X11 server using Xlib' +refDesc['vkGetPipelineCacheData'] = 'Get the data store from a pipeline cache' +refDesc['vkGetQueryPoolResults'] = 'Copy results of queries in a query pool to a host memory region' +refDesc['vkGetRenderAreaGranularity'] = 'Returns the granularity for optimal render area' +refDesc['vkGetSwapchainImagesKHR'] = 'Obtain the array of presentable images associated with a swapchain' +refDesc['VkImageCreateFlags'] = 'Image object creation flags' +refDesc['VkImageCreateInfo'] = 'Structure specifying the parameters of a newly created image object' +refDesc['VkImageLayout'] = 'Layout of image and image subresources' +refDesc['VkImageMemoryBarrier'] = 'Structure specifying the parameters of an image memory barrier' +refDesc['VkImageType'] = 'Specifies the type of an image object' +refDesc['VkImageUsageFlags'] = 'Image object usage flags' +refDesc['VkImageViewType'] = 'Image view types' +refDesc['vkInvalidateMappedMemoryRanges'] = 'Invalidate ranges of mapped memory objects' +refDesc['vkMapMemory'] = 'Map a memory object into application address space' +refDesc['VkMemoryAllocateInfo'] = 'Structure containing parameters of a memory allocation' +refDesc['VkMemoryPropertyFlags'] = 'Memory pool properties' +refDesc['vkMergePipelineCaches'] = 'Combine the data stores of pipeline caches' +refDesc['VkPhysicalDeviceFeatures'] = 'Structure describing the fine-grained features that can be supported by an implementation' +refDesc['VkPhysicalDeviceLimits'] = 'Structure' +refDesc['VkPipelineLayoutCreateInfo'] = 'Structure specifying the parameters of a newly created pipeline layout object' +refDesc['VkPipelineStageFlags'] = 'Pipeline stage identifiers' +refDesc['VkQueryControlFlags'] = 'Query control flags' +refDesc['VkQueryResultFlags'] = 'Query result flags' +refDesc['vkQueueBindSparse'] = 'Bind device memory to a sparse resource object' +refDesc['VkQueueFamilyProperties'] = 'Structure providing information about a queue family' +refDesc['VkQueueFlags'] = 'Queue capability flags' +refDesc['vkQueuePresentKHR'] = 'Queue an image for presentation' +refDesc['vkQueueSubmit'] = 'Submits a sequence of semaphores or command buffers to a queue' +refDesc['vkQueueWaitIdle'] = 'Wait for a queue to become idle' +refDesc['vkResetCommandBuffer'] = 'Reset a command buffer' +refDesc['vkResetCommandPool'] = 'Reset a command pool' +refDesc['vkResetDescriptorPool'] = 'Resets a descriptor pool object' +refDesc['vkResetEvent'] = 'Reset an event to non-signaled state' +refDesc['vkResetFences'] = 'Resets one or more fence objects' +refDesc['vkSetEvent'] = 'Set an event to signaled state' +refDesc['VkSharingMode'] = 'Buffer and image sharing modes' +refDesc['vkUnmapMemory'] = 'Unmap a previously mapped memory object' +refDesc['vkUpdateDescriptorSets'] = 'Update the contents of a descriptor set object' +refDesc['vkWaitForFences'] = 'Wait for one or more fences to become signaled' +refDesc['VkWriteDescriptorSet'] = 'Structure specifying the parameters of a descriptor set write operation' +refDesc['VkAndroidSurfaceCreateInfoKHR'] = 'Structure specifying parameters of a newly created Android surface object' +refDesc['VkDebugReportCallbackCreateInfoEXT'] = 'Structure specifying parameters of a newly created debug report object' +refDesc['VkDisplayModeCreateInfoKHR'] = 'Structure specifying parameters of a newly created display mode object' +refDesc['VkDisplayModeParametersKHR'] = 'Structure describing display parameters associated with a display mode' +refDesc['VkDisplayModePropertiesKHR'] = 'Structure describing display mode properties' +refDesc['VkDisplayPlaneCapabilitiesKHR'] = 'Structure describing capabilities of a mode and plane combination' +refDesc['VkDisplayPlanePropertiesKHR'] = 'Structure describing display plane properties' +refDesc['VkDisplayPresentInfoKHR'] = 'Structure describing parameters of a queue presentation to a swapchain' +refDesc['VkDisplayPropertiesKHR'] = 'Structure describing an available display device' +refDesc['VkDisplaySurfaceCreateInfoKHR'] = 'Structure specifying parameters of a newly created display plane surface object' +refDesc['VkMirSurfaceCreateInfoKHR'] = 'Structure specifying parameters of a newly created Mir surface object' +refDesc['VkPresentInfoKHR'] = 'Structure describing parameters of a queue presentation' +refDesc['VkSurfaceCapabilitiesKHR'] = 'Structure describing capabilities of a surface' +refDesc['VkSurfaceFormatKHR'] = 'Structure describing a supported swapchain format-colorspace pair' +refDesc['VkSwapchainCreateInfoKHR'] = 'Structure specifying parameters of a newly created swapchain object' +refDesc['VkWaylandSurfaceCreateInfoKHR'] = 'Structure specifying parameters of a newly created Wayland surface object' +refDesc['VkWin32SurfaceCreateInfoKHR'] = 'Structure specifying parameters of a newly created Win32 surface object' +refDesc['VkXcbSurfaceCreateInfoKHR'] = 'Structure specifying parameters of a newly created Xcb surface object' +refDesc['VkXlibSurfaceCreateInfoKHR'] = 'Structure specifying parameters of a newly created Xlib surface object' + +# These are generated based on the structure name + +refDesc['VkBufferViewCreateInfo'] = 'Structure specifying parameters of a newly created buffer view' +refDesc['VkCommandPoolCreateInfo'] = 'Structure specifying parameters of a newly created command pool' +refDesc['VkComputePipelineCreateInfo'] = 'Structure specifying parameters of a newly created compute pipeline' +refDesc['VkDescriptorPoolCreateInfo'] = 'Structure specifying parameters of a newly created descriptor pool' +refDesc['VkDescriptorSetLayoutCreateInfo'] = 'Structure specifying parameters of a newly created descriptor set layout' +refDesc['VkDeviceCreateInfo'] = 'Structure specifying parameters of a newly created device' +refDesc['VkDeviceQueueCreateInfo'] = 'Structure specifying parameters of a newly created device queue' +refDesc['VkEventCreateInfo'] = 'Structure specifying parameters of a newly created event' +refDesc['VkExtent2D'] = 'Structure specifying a two-dimensional extent' +refDesc['VkExtent3D'] = 'Structure specifying a three-dimensional extent' +refDesc['VkFenceCreateInfo'] = 'Structure specifying parameters of a newly created fence' +refDesc['VkFramebufferCreateInfo'] = 'Structure specifying parameters of a newly created framebuffer' +refDesc['VkGraphicsPipelineCreateInfo'] = 'Structure specifying parameters of a newly created graphics pipeline' +refDesc['VkImageViewCreateInfo'] = 'Structure specifying parameters of a newly created image view' +refDesc['VkInstanceCreateInfo'] = 'Structure specifying parameters of a newly created instance' +refDesc['VkOffset2D'] = 'Structure specifying a two-dimensional offset' +refDesc['VkOffset3D'] = 'Structure specifying a three-dimensional offset' +refDesc['VkPipelineCacheCreateInfo'] = 'Structure specifying parameters of a newly created pipeline cache' +refDesc['VkPipelineColorBlendStateCreateInfo'] = 'Structure specifying parameters of a newly created pipeline color blend state' +refDesc['VkPipelineDepthStencilStateCreateInfo'] = 'Structure specifying parameters of a newly created pipeline depth stencil state' +refDesc['VkPipelineDynamicStateCreateInfo'] = 'Structure specifying parameters of a newly created pipeline dynamic state' +refDesc['VkPipelineInputAssemblyStateCreateInfo'] = 'Structure specifying parameters of a newly created pipeline input assembly state' +refDesc['VkPipelineMultisampleStateCreateInfo'] = 'Structure specifying parameters of a newly created pipeline multisample state' +refDesc['VkPipelineRasterizationStateCreateInfo'] = 'Structure specifying parameters of a newly created pipeline rasterization state' +refDesc['VkPipelineShaderStageCreateInfo'] = 'Structure specifying parameters of a newly created pipeline shader stage' +refDesc['VkPipelineTessellationStateCreateInfo'] = 'Structure specifying parameters of a newly created pipeline tessellation state' +refDesc['VkPipelineVertexInputStateCreateInfo'] = 'Structure specifying parameters of a newly created pipeline vertex input state' +refDesc['VkPipelineViewportStateCreateInfo'] = 'Structure specifying parameters of a newly created pipeline viewport state' +refDesc['VkQueryPoolCreateInfo'] = 'Structure specifying parameters of a newly created query pool' +refDesc['VkRect2D'] = 'Structure specifying a two-dimensional subregion' +refDesc['VkRenderPassCreateInfo'] = 'Structure specifying parameters of a newly created render pass' +refDesc['VkSamplerCreateInfo'] = 'Structure specifying parameters of a newly created sampler' +refDesc['VkSemaphoreCreateInfo'] = 'Structure specifying parameters of a newly created semaphore' +refDesc['VkShaderModuleCreateInfo'] = 'Structure specifying parameters of a newly created shader module' + +# These are TBD + +refDesc['VkApplicationInfo'] = 'Structure specifying application info' +refDesc['VkAttachmentDescription'] = 'Structure specifying an attachment description' +refDesc['VkAttachmentReference'] = 'Structure specifying an attachment reference' +refDesc['VkBindSparseInfo'] = 'Structure specifying a sparse binding operation' +refDesc['VkBufferCopy'] = 'Structure specifying a buffer copy operation' +refDesc['VkBufferImageCopy'] = 'Structure specifying a buffer image copy operation' +refDesc['VkClearAttachment'] = 'Structure specifying a clear attachment' +refDesc['VkClearColorValue'] = 'Structure specifying a clear color value' +refDesc['VkClearDepthStencilValue'] = 'Structure specifying a clear depth stencil value' +refDesc['VkClearRect'] = 'Structure specifying a clear rectangle' +refDesc['VkClearValue'] = 'Structure specifying a clear value' +refDesc['VkCommandBufferBeginInfo'] = 'Structure specifying a command buffer begin operation' +refDesc['VkCommandBufferInheritanceInfo'] = 'Structure specifying command buffer inheritance info' +refDesc['VkCommandBufferLevel'] = 'Structure specifying a command buffer level' +refDesc['VkComponentMapping'] = 'Structure specifying a color component mapping' +refDesc['VkCopyDescriptorSet'] = 'Structure specifying a copy descriptor set operation' +refDesc['VkDescriptorBufferInfo'] = 'Structure specifying descriptor buffer info' +refDesc['VkDescriptorImageInfo'] = 'Structure specifying descriptor image info' +refDesc['VkDescriptorPoolSize'] = 'Structure specifying descriptor pool size' +refDesc['VkDescriptorSetLayoutBinding'] = 'Structure specifying a descriptor set layout binding' +refDesc['VkDispatchIndirectCommand'] = 'Structure specifying a dispatch indirect command' +refDesc['VkDrawIndexedIndirectCommand'] = 'Structure specifying a draw indexed indirect command' +refDesc['VkDrawIndirectCommand'] = 'Structure specifying a draw indirect command' +refDesc['VkExtensionProperties'] = 'Structure specifying a extension properties' +refDesc['VkFormatProperties'] = 'Structure specifying image format properties' +refDesc['VkImageBlit'] = 'Structure specifying an image blit operation' +refDesc['VkImageCopy'] = 'Structure specifying an image copy operation' +refDesc['VkImageFormatProperties'] = 'Structure specifying a image format properties' +refDesc['VkImageResolve'] = 'Structure specifying an image resolve operation' +refDesc['VkImageSubresource'] = 'Structure specifying a image subresource' +refDesc['VkImageSubresourceLayers'] = 'Structure specifying a image subresource layers' +refDesc['VkImageSubresourceRange'] = 'Structure specifying a image subresource range' +refDesc['VkLayerProperties'] = 'Structure specifying layer properties' +refDesc['VkMappedMemoryRange'] = 'Structure specifying a mapped memory range' +refDesc['VkMemoryBarrier'] = 'Structure specifying a memory barrier' +refDesc['VkMemoryHeap'] = 'Structure specifying a memory heap' +refDesc['VkMemoryRequirements'] = 'Structure specifying memory requirements' +refDesc['VkMemoryType'] = 'Structure specifying memory type' +refDesc['VkPhysicalDeviceMemoryProperties'] = 'Structure specifying physical device memory properties' +refDesc['VkPhysicalDeviceProperties'] = 'Structure specifying physical device properties' +refDesc['VkPhysicalDeviceSparseProperties'] = 'Structure specifying physical device sparse memory properties' +refDesc['VkPipelineColorBlendAttachmentState'] = 'Structure specifying a pipeline color blend attachment state' +refDesc['VkPushConstantRange'] = 'Structure specifying a push constant range' +refDesc['VkRenderPassBeginInfo'] = 'Structure specifying render pass begin info' +refDesc['VkSparseBufferMemoryBindInfo'] = 'Structure specifying a sparse buffer memory bind operation' +refDesc['VkSparseImageFormatProperties'] = 'Structure specifying sparse image format properties' +refDesc['VkSparseImageMemoryBind'] = 'Structure specifying sparse image memory bind' +refDesc['VkSparseImageMemoryBindInfo'] = 'Structure specifying sparse image memory bind info' +refDesc['VkSparseImageMemoryRequirements'] = 'Structure specifying sparse image memory requirements' +refDesc['VkSparseImageOpaqueMemoryBindInfo'] = 'Structure specifying sparse image opaque memory bind info' +refDesc['VkSparseMemoryBind'] = 'Structure specifying a sparse memory bind operation' +refDesc['VkSpecializationInfo'] = 'Structure specifying specialization info' +refDesc['VkSpecializationMapEntry'] = 'Structure specifying a specialization map entry' +refDesc['VkStencilOpState'] = 'Structure specifying stencil operation state' +refDesc['VkSubmitInfo'] = 'Structure specifying a queue submit operation' +refDesc['VkSubpassDependency'] = 'Structure specifying a subpass dependency' +refDesc['VkSubpassDescription'] = 'Structure specifying a subpass description' +refDesc['VkSubresourceLayout'] = 'Structure specifying subresource layout' +refDesc['VkVertexInputAttributeDescription'] = 'Structure specifying vertex input attribute description' +refDesc['VkVertexInputBindingDescription'] = 'Structure specifying vertex input binding description' +refDesc['VkViewport'] = 'Structure specifying a viewport' + +# These are constructed from spec text + +refDesc['VkAccessFlagBits'] = 'Bitmask specifying classes of memory access the will participate in a memory barrier dependency' +refDesc['VkAttachmentDescriptionFlagBits'] = 'Bitmask specifying additional properties of an attachment' +refDesc['VkBufferCreateFlagBits'] = 'Bitmask specifying additional parameters of a buffer' +refDesc['VkBufferUsageFlagBits'] = 'Bitmask specifying allowed usage of a buffer' +refDesc['VkColorComponentFlagBits'] = 'Bitmask controlling which components are written to the framebuffer' +refDesc['VkCommandBufferResetFlagBits'] = 'Bitmask controlling behavior of a command buffer reset' +refDesc['VkCommandBufferUsageFlagBits'] = 'Bitmask specifying usage behavior for command buffer' +refDesc['VkCommandPoolCreateFlagBits'] = 'Bitmask specifying usage behavior for a command pool' +refDesc['VkCommandPoolResetFlagBits'] = 'Bitmask controlling behavior of a command pool reset' +refDesc['VkCullModeFlagBits'] = 'Bitmask controlling triangle culling' +refDesc['VkDependencyFlagBits'] = 'Bitmask specifying dependencies between subpasses' +refDesc['VkDescriptorPoolCreateFlagBits'] = 'Bitmask specifying certain supported operations on a descriptor pool' +refDesc['VkFenceCreateFlagBits'] = 'Bitmask specifying initial state and behavior of a fence' +refDesc['VkFormatFeatureFlagBits'] = 'Bitmask specifying features supported by a buffer' +refDesc['VkImageAspectFlagBits'] = 'Bitmask specifying which aspects of an image are included in a view' +refDesc['VkImageCreateFlagBits'] = 'Bitmask specifying additional parameters of an image' +refDesc['VkImageUsageFlagBits'] = 'Bitmask specifying intended usage of an image' +refDesc['VkMemoryHeapFlagBits'] = 'Bitmask specifying attribute flags for a heap' +refDesc['VkMemoryPropertyFlagBits'] = 'Bitmask specifying properties for a memory type' +refDesc['VkPipelineCreateFlagBits'] = 'Bitmask controlling how a pipeline is generated' +refDesc['VkPipelineStageFlagBits'] = 'Bitmask specifying pipeline stages' +refDesc['VkQueryControlFlagBits'] = 'Bitmask specifying constraints on a query' +refDesc['VkQueryPipelineStatisticFlagBits'] = 'Bitmask specifying queried pipeline statistics' +refDesc['VkQueryResultFlagBits'] = 'Bitmask specifying how and when query results are returned' +refDesc['VkQueueFlagBits'] = 'Bitmask specifying capabilities of queues in a queue family' +refDesc['VkSampleCountFlagBits'] = 'Bitmask specifying sample counts supported for an image used for storage operations' +refDesc['VkShaderStageFlagBits'] = 'Bitmask specifying a pipeline stage' +refDesc['VkSparseImageFormatFlagBits'] = 'Bitmask specifying additional information about a sparse image resource' +refDesc['VkSparseMemoryBindFlagBits'] = 'Bitmask specifying usage of a sparse memory binding operation' +refDesc['VkStencilFaceFlagBits'] = 'Bitmask specifying sets of stencil state for which to update the compare mask' |