From bc4a9e58c724cbe907cd098ea2110c5296e2f48e Mon Sep 17 00:00:00 2001 From: Mark Young Date: Thu, 4 May 2017 15:10:59 -0600 Subject: 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 --- scripts/loader_extension_generator.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'scripts/loader_extension_generator.py') 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 -- cgit v1.2.3