loader: Fix debug utils terminators being skipped
Change-Id: I9e08b59669bd301e3c5361ae4ea16102461fb34b
diff --git a/loader/loader.c b/loader/loader.c
index 43f204f..967bb58 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1,8 +1,8 @@
/*
*
- * Copyright (c) 2014-2019 The Khronos Group Inc.
- * Copyright (c) 2014-2019 Valve Corporation
- * Copyright (c) 2014-2019 LunarG, Inc.
+ * Copyright (c) 2014-2020 The Khronos Group Inc.
+ * Copyright (c) 2014-2020 Valve Corporation
+ * Copyright (c) 2014-2020 LunarG, Inc.
* Copyright (C) 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -2044,7 +2044,7 @@
return res;
}
-struct loader_icd_term *loader_get_icd_and_device(const VkDevice device, struct loader_device **found_dev, uint32_t *icd_index) {
+struct loader_icd_term *loader_get_icd_and_device(const void *device, struct loader_device **found_dev, uint32_t *icd_index) {
*found_dev = NULL;
for (struct loader_instance *inst = loader.instances; inst; inst = inst->next) {
uint32_t index = 0;
@@ -4852,6 +4852,32 @@
return (PFN_vkVoidFunction)terminator_CreateDevice;
}
+ // The VK_EXT_debug_utils functions need a special case here so the terminators can still be found from vkGetInstanceProcAddr
+ if (!strcmp(pName, "vkSetDebugUtilsObjectNameEXT")) {
+ return (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectNameEXT;
+ }
+ if (!strcmp(pName, "vkSetDebugUtilsObjectTagEXT")) {
+ return (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectTagEXT;
+ }
+ if (!strcmp(pName, "vkQueueBeginDebugUtilsLabelEXT")) {
+ return (PFN_vkVoidFunction)terminator_QueueBeginDebugUtilsLabelEXT;
+ }
+ if (!strcmp(pName, "vkQueueEndDebugUtilsLabelEXT")) {
+ return (PFN_vkVoidFunction)terminator_QueueEndDebugUtilsLabelEXT;
+ }
+ if (!strcmp(pName, "vkQueueInsertDebugUtilsLabelEXT")) {
+ return (PFN_vkVoidFunction)terminator_QueueInsertDebugUtilsLabelEXT;
+ }
+ if (!strcmp(pName, "vkCmdBeginDebugUtilsLabelEXT")) {
+ return (PFN_vkVoidFunction)terminator_CmdBeginDebugUtilsLabelEXT;
+ }
+ if (!strcmp(pName, "vkCmdEndDebugUtilsLabelEXT")) {
+ return (PFN_vkVoidFunction)terminator_CmdEndDebugUtilsLabelEXT;
+ }
+ if (!strcmp(pName, "vkCmdInsertDebugUtilsLabelEXT")) {
+ return (PFN_vkVoidFunction)terminator_CmdInsertDebugUtilsLabelEXT;
+ }
+
// inst is not wrapped
if (inst == VK_NULL_HANDLE) {
return NULL;
diff --git a/loader/loader.h b/loader/loader.h
index 40bb23b..7e6d601 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -477,7 +477,7 @@
bool loaderImplicitLayerIsEnabled(const struct loader_instance *inst, const struct loader_layer_properties *prop);
VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list,
struct loader_extension_list *inst_exts);
-struct loader_icd_term *loader_get_icd_and_device(const VkDevice device, struct loader_device **found_dev, uint32_t *icd_index);
+struct loader_icd_term *loader_get_icd_and_device(const void *device, struct loader_device **found_dev, uint32_t *icd_index);
void loader_init_dispatch_dev_ext(struct loader_instance *inst, struct loader_device *dev);
void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName);
void *loader_get_dev_ext_trampoline(uint32_t index);
diff --git a/scripts/loader_extension_generator.py b/scripts/loader_extension_generator.py
index c1f6b41..93952b6 100644
--- a/scripts/loader_extension_generator.py
+++ b/scripts/loader_extension_generator.py
@@ -1,8 +1,8 @@
#!/usr/bin/python3 -i
#
-# Copyright (c) 2015-2017 The Khronos Group Inc.
-# Copyright (c) 2015-2017 Valve Corporation
-# Copyright (c) 2015-2017 LunarG, Inc.
+# Copyright (c) 2015-2020 The Khronos Group Inc.
+# Copyright (c) 2015-2020 Valve Corporation
+# Copyright (c) 2015-2020 LunarG, Inc.
# Copyright (c) 2015-2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -63,6 +63,12 @@
'vkDebugMarkerSetObjectNameEXT',
'vkSetDebugUtilsObjectNameEXT',
'vkSetDebugUtilsObjectTagEXT',
+ 'vkQueueBeginDebugUtilsLabelEXT',
+ 'vkQueueEndDebugUtilsLabelEXT',
+ 'vkQueueInsertDebugUtilsLabelEXT',
+ 'vkCmdBeginDebugUtilsLabelEXT',
+ 'vkCmdEndDebugUtilsLabelEXT',
+ 'vkCmdInsertDebugUtilsLabelEXT',
'vkGetDeviceGroupSurfacePresentModes2EXT']
# These are the aliased functions that use the same terminator for both extension and core versions
@@ -1180,29 +1186,7 @@
elif ext_cmd.handle_type == 'VkInstance':
funcs += '#error("Not implemented. Likely needs to be manually generated!");\n'
- elif 'DebugUtilsLabel' in ext_cmd.name:
- funcs += ' const VkLayerDispatchTable *disp = loader_get_dispatch('
- funcs += ext_cmd.params[0].name
- funcs += ');\n'
- if ext_cmd.ext_name in NULL_CHECK_EXT_NAMES:
- funcs += ' if (disp->' + base_name + ' != NULL) {\n'
- funcs += ' '
- funcs += ' '
- if has_return_type:
- funcs += 'return '
- funcs += 'disp->'
- funcs += base_name
- funcs += '('
- count = 0
- for param in ext_cmd.params:
- if count != 0:
- funcs += ', '
- funcs += param.name
- count += 1
- funcs += ');\n'
- if ext_cmd.ext_name in NULL_CHECK_EXT_NAMES:
- funcs += ' }\n'
- elif 'DebugMarkerSetObject' in ext_cmd.name or 'SetDebugUtilsObject' in ext_cmd.name:
+ elif 'DebugMarkerSetObject' in ext_cmd.name or 'SetDebugUtilsObject' in ext_cmd.name or 'DebugUtilsLabel' in ext_cmd.name:
funcs += ' uint32_t icd_index = 0;\n'
funcs += ' struct loader_device *dev;\n'
funcs += ' struct loader_icd_term *icd_term = loader_get_icd_and_device(%s, &dev, &icd_index);\n' % (ext_cmd.params[0].name)