layers: Don't confuse VkResult/VkBool32 in generators.
authorJamie Madill <jmadill@chromium.org>
Wed, 8 Nov 2017 19:11:26 +0000 (14:11 -0500)
committerTobin Ehlis <tobine@google.com>
Thu, 9 Nov 2017 16:51:07 +0000 (09:51 -0700)
In some cases, the generator would return the special error for
validation failed for functions that return a VkBool32. Fix this, and
also some cases of initializing a VkBool32 with VkResult.

Change-Id: Icc071e647f293848d62a922d492ed41dfc5a4be1

scripts/object_tracker_generator.py
scripts/parameter_validation_generator.py

index 50e19cc3048a807f364346326a265df0cc489688..4350fa39ff36ccdf0aeb55e5cee3ee46a86c3672 100644 (file)
@@ -937,7 +937,12 @@ class ObjectTrackerOutputGenerator(OutputGenerator):
             API = cmdinfo.elem.attrib.get('name').replace('vk', dispatch_table, 1)
             # Put all this together for the final down-chain call
             if assignresult != '':
-                self.appendSection('command', '    if (skip) return VK_ERROR_VALIDATION_FAILED_EXT;')
+                if resulttype.text == 'VkResult':
+                    self.appendSection('command', '    if (skip) return VK_ERROR_VALIDATION_FAILED_EXT;')
+                elif resulttype.text == 'VkBool32':
+                    self.appendSection('command', '    if (skip) return VK_FALSE;')
+                else:
+                    raise Exception('Unknown result type ' + resulttype.text)
             else:
                 self.appendSection('command', '    if (skip) return;')
             self.appendSection('command', '    ' + assignresult + API + '(' + paramstext + ');')
index 01ed1bbf780df9070471adbe5f667619e28b50e7..9c673fc455db848cf8884b07763589bdad113f2f 100644 (file)
@@ -1200,7 +1200,13 @@ class ParameterValidationOutputGenerator(OutputGenerator):
                 cmdDef += '%sbool skip = false;\n' % indent
                 if not just_validate:
                     if command.result != '':
-                        cmdDef += indent + '%s result = VK_ERROR_VALIDATION_FAILED_EXT;\n' % command.result
+                        if command.result == "VkResult":
+                            cmdDef += indent + '%s result = VK_ERROR_VALIDATION_FAILED_EXT;\n' % command.result
+                        elif command.result == "VkBool32":
+                            cmdDef += indent + '%s result = VK_FALSE;\n' % command.result
+                        else:
+                            raise Exception("Unknown result type: " + command.result)
+
                     cmdDef += '%sstd::unique_lock<std::mutex> lock(global_lock);\n' % indent
                 for line in lines:
                     cmdDef += '\n'