summaryrefslogtreecommitdiff
path: root/vk-layer-generate.py
diff options
context:
space:
mode:
authorIan Elliott <ianelliott@google.com>2016-04-28 09:08:13 -0600
committerIan Elliott <ianelliott@google.com>2016-04-28 09:13:02 -0600
commitf0c42bb0a2bb448cacc157a158e9fc08171f8c6b (patch)
tree958053510380be70880675d605822364c426430b /vk-layer-generate.py
parent53bc66f7296af6e8ff01d7105a3fced9a7dfcbc6 (diff)
layers: Use tmp callback for msgs during vk{Create|Destroy}Instance().
This is implements some relatively-new functionality of the VK_EXT_debug_report extension. An application can pass VkDebugReportCallbackCreateInfoEXT structs on the pNext chain given to vkCreateInstance(), in order to setup one or more callbacks that can be used during vk{Create|Destroy}Instance(). These special, "temporary callbacks" allow messages (e.g. errors) to be logged during the time when the debug_report extension is normally not setup. A set of utilities copy VkDebugReportCallbackCreateInfoEXT structs from the pNext chain given to vkCreateInstance(). These utilities are used by the validation layers that may have messages (e.g. errors) during vk{Create|Destroy}Instance().
Diffstat (limited to 'vk-layer-generate.py')
-rwxr-xr-xvk-layer-generate.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/vk-layer-generate.py b/vk-layer-generate.py
index ba9084c5..f3194c27 100755
--- a/vk-layer-generate.py
+++ b/vk-layer-generate.py
@@ -949,6 +949,21 @@ class ObjectTrackerSubcommand(Subcommand):
gedi_txt.append('const VkAllocationCallbacks* pAllocator)')
gedi_txt.append('{')
gedi_txt.append(' std::unique_lock<std::mutex> lock(global_lock);')
+ gedi_txt.append('')
+ gedi_txt.append(' dispatch_key key = get_dispatch_key(instance);')
+ gedi_txt.append(' layer_data *my_data = get_my_data_ptr(key, layer_data_map);')
+ gedi_txt.append('')
+ gedi_txt.append(' // Enable the temporary callback(s) here to catch cleanup issues:')
+ gedi_txt.append(' bool callback_setup = false;')
+ gedi_txt.append(' if (my_data->num_tmp_callbacks > 0) {')
+ gedi_txt.append(' if (!layer_enable_tmp_callbacks(my_data->report_data,')
+ gedi_txt.append(' my_data->num_tmp_callbacks,')
+ gedi_txt.append(' my_data->tmp_dbg_create_infos,')
+ gedi_txt.append(' my_data->tmp_callbacks)) {')
+ gedi_txt.append(' callback_setup = true;')
+ gedi_txt.append(' }')
+ gedi_txt.append(' }')
+ gedi_txt.append('')
gedi_txt.append(' validate_instance(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false);')
gedi_txt.append('')
gedi_txt.append(' destroy_instance(instance, instance);')
@@ -980,11 +995,21 @@ class ObjectTrackerSubcommand(Subcommand):
gedi_txt.append(' }')
gedi_txt.append(' }')
gedi_txt.append('')
- gedi_txt.append(' dispatch_key key = get_dispatch_key(instance);')
gedi_txt.append(' VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(object_tracker_instance_table_map, instance);')
gedi_txt.append(' pInstanceTable->DestroyInstance(instance, pAllocator);')
gedi_txt.append('')
- gedi_txt.append(' layer_data *my_data = get_my_data_ptr(key, layer_data_map);')
+ gedi_txt.append(' // Disable and cleanup the temporary callback(s):')
+ gedi_txt.append(' if (callback_setup) {')
+ gedi_txt.append(' layer_disable_tmp_callbacks(my_data->report_data,')
+ gedi_txt.append(' my_data->num_tmp_callbacks,')
+ gedi_txt.append(' my_data->tmp_callbacks);')
+ gedi_txt.append(' }')
+ gedi_txt.append(' if (my_data->num_tmp_callbacks > 0) {')
+ gedi_txt.append(' layer_free_tmp_callbacks(my_data->tmp_dbg_create_infos,')
+ gedi_txt.append(' my_data->tmp_callbacks);')
+ gedi_txt.append(' my_data->num_tmp_callbacks = 0;')
+ gedi_txt.append(' }')
+ gedi_txt.append('')
gedi_txt.append(' // Clean up logging callback, if any')
gedi_txt.append(' while (my_data->logging_callback.size() > 0) {')
gedi_txt.append(' VkDebugReportCallbackEXT callback = my_data->logging_callback.back();')