aboutsummaryrefslogtreecommitdiff
path: root/scripts/loader_extension_generator.py
diff options
context:
space:
mode:
authorMark Young <marky@lunarg.com>2017-05-04 15:10:59 -0600
committerMark Young <marky@lunarg.com>2017-05-05 13:26:08 -0600
commitbc4a9e58c724cbe907cd098ea2110c5296e2f48e (patch)
tree3edc222cc85c93c70983a482494ca33bf7617945 /scripts/loader_extension_generator.py
parentecc775f1a76773cbea037ee3a8003e32968b719b (diff)
downloadusermoji-bc4a9e58c724cbe907cd098ea2110c5296e2f48e.tar.xz
loader: gh1693 - GPDA override not used
In some situations, the loader wouldn't directly use the GetInstanceProcAddr or GetDeviceProcAddr function overrides directly. Instead, the loader would call vkGetInstanceProcAddr with an argument of "vkGetInstanceProcAddr" and vkGetDeviceProcAddr with an argument of "vkGetDeviceProcAddr". This short-cuts that. NOTE: Layers still need to support these queries because if another layer is above you, it may call "vkGetInstanceProcAddr" with to get "vkGetDeviceProcAddr". Change-Id: I810945f45121d42d23b69d0b3334d6bad3a8ed2f
Diffstat (limited to 'scripts/loader_extension_generator.py')
-rw-r--r--scripts/loader_extension_generator.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/loader_extension_generator.py b/scripts/loader_extension_generator.py
index 8a8586f2..0a0f04e7 100644
--- a/scripts/loader_extension_generator.py
+++ b/scripts/loader_extension_generator.py
@@ -687,7 +687,6 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
tables += ' VkDevice dev) {\n'
tables += ' VkLayerDispatchTable *table = &dev_table->core_dispatch;\n'
tables += ' for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) dev_table->ext_dispatch.dev_ext[i] = (PFN_vkDevExt)vkDevExtError;\n'
- tables += '\n'
elif x == 1:
cur_type = 'device'
@@ -698,7 +697,6 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
tables += 'VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct loader_dev_dispatch_table *dev_table,\n'
tables += ' PFN_vkGetDeviceProcAddr gpa, VkDevice dev) {\n'
tables += ' VkLayerDispatchTable *table = &dev_table->core_dispatch;\n'
- tables += '\n'
elif x == 2:
cur_type = 'instance'
@@ -740,7 +738,14 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
if cur_cmd.protect is not None:
tables += '#ifdef %s\n' % cur_cmd.protect
- tables += ' table->%s = (PFN_%s)gpa(%s, "%s");\n' % (base_name, cur_cmd.name, gpa_param, cur_cmd.name)
+ # If we're looking for the proc we are passing in, just point the table to it. This fixes the issue where
+ # a layer overrides the function name for the loader.
+ if (x <= 1 and base_name == 'GetDeviceProcAddr'):
+ tables += ' table->GetDeviceProcAddr = gpa;\n'
+ elif (x > 1 and base_name == 'GetInstanceProcAddr'):
+ tables += ' table->GetInstanceProcAddr = gpa;\n'
+ else:
+ tables += ' table->%s = (PFN_%s)gpa(%s, "%s");\n' % (base_name, cur_cmd.name, gpa_param, cur_cmd.name)
if cur_cmd.protect is not None:
tables += '#endif // %s\n' % cur_cmd.protect