aboutsummaryrefslogtreecommitdiff
path: root/generator.py
diff options
context:
space:
mode:
authorChia-I Wu <olv@google.com>2016-05-16 09:58:50 +0800
committerTobin Ehlis <tobine@google.com>2016-05-24 06:29:13 -0600
commit89bb820f7aae5c9f806059591c70a3708c686abb (patch)
tree509cf29a8d425ff881acfcd26bc91481339476b8 /generator.py
parent178a141e98658884c012bc40d02f2311d33c7e9d (diff)
downloadusermoji-89bb820f7aae5c9f806059591c70a3708c686abb.tar.xz
threading: put layer functions into a namespace
Put all layer fucntions/data into threading namespace. I had to add some wrappers to make everything work. This also removes vkEnumerateInstance*Properties from procmap. procmap is used in vkGetDeviceProcAddr and it should not contain vkEnumerateInstance*Properties in the first place.
Diffstat (limited to 'generator.py')
-rw-r--r--generator.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/generator.py b/generator.py
index eead2119..abb0dbf1 100644
--- a/generator.py
+++ b/generator.py
@@ -2629,15 +2629,13 @@ class ThreadOutputGenerator(OutputGenerator):
OutputGenerator.beginFile(self, genOpts)
# C-specific
#
- # Multiple inclusion protection & C++ wrappers.
+ # Multiple inclusion protection & C++ namespace.
if (genOpts.protectFile and self.genOpts.filename):
headerSym = '__' + re.sub('\.h', '_h_', os.path.basename(self.genOpts.filename))
write('#ifndef', headerSym, file=self.outFile)
write('#define', headerSym, '1', file=self.outFile)
self.newline()
- write('#ifdef __cplusplus', file=self.outFile)
- write('extern "C" {', file=self.outFile)
- write('#endif', file=self.outFile)
+ write('namespace threading {', file=self.outFile)
self.newline()
#
# User-supplied prefix text, if any (list of strings)
@@ -2646,7 +2644,7 @@ class ThreadOutputGenerator(OutputGenerator):
write(s, file=self.outFile)
def endFile(self):
# C-specific
- # Finish C++ wrapper and multiple inclusion protection
+ # Finish C++ namespace and multiple inclusion protection
self.newline()
# record intercepted procedures
write('// intercepts', file=self.outFile)
@@ -2654,9 +2652,7 @@ class ThreadOutputGenerator(OutputGenerator):
write('\n'.join(self.intercepts), file=self.outFile)
write('};\n', file=self.outFile)
self.newline()
- write('#ifdef __cplusplus', file=self.outFile)
- write('}', file=self.outFile)
- write('#endif', file=self.outFile)
+ write('} // namespace threading', file=self.outFile)
if (self.genOpts.protectFile and self.genOpts.filename):
self.newline()
write('#endif', file=self.outFile)
@@ -2743,6 +2739,14 @@ class ThreadOutputGenerator(OutputGenerator):
#
# Command generation
def genCmd(self, cmdinfo, name):
+ # Commands shadowed by interface functions and are not implemented
+ interface_functions = [
+ 'vkEnumerateInstanceLayerProperties',
+ 'vkEnumerateInstanceExtensionProperties',
+ 'vkEnumerateDeviceLayerProperties',
+ ]
+ if name in interface_functions:
+ return
special_functions = [
'vkGetDeviceProcAddr',
'vkGetInstanceProcAddr',
@@ -2750,14 +2754,16 @@ class ThreadOutputGenerator(OutputGenerator):
'vkDestroyDevice',
'vkCreateInstance',
'vkDestroyInstance',
- 'vkEnumerateInstanceLayerProperties',
- 'vkEnumerateInstanceExtensionProperties',
'vkAllocateCommandBuffers',
'vkFreeCommandBuffers',
'vkCreateDebugReportCallbackEXT',
'vkDestroyDebugReportCallbackEXT',
]
if name in special_functions:
+ decls = self.makeCDecls(cmdinfo.elem)
+ self.appendSection('command', '')
+ self.appendSection('command', '// declare only')
+ self.appendSection('command', decls[0])
self.intercepts += [ ' {"%s", reinterpret_cast<PFN_vkVoidFunction>(%s)},' % (name,name) ]
return
if "KHR" in name: