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/dispatch_table_helper_generator.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'scripts/dispatch_table_helper_generator.py') diff --git a/scripts/dispatch_table_helper_generator.py b/scripts/dispatch_table_helper_generator.py index 971eba7c..fd0ab313 100644 --- a/scripts/dispatch_table_helper_generator.py +++ b/scripts/dispatch_table_helper_generator.py @@ -190,7 +190,16 @@ class DispatchTableHelperOutputGenerator(OutputGenerator): if item[1] is not None: table += '#ifdef %s\n' % item[1] - table += ' table->%s = (PFN_%s) gpa(%s, "%s");\n' % (base_name, item[0], table_type, item[0]) + + # 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 (table_type == 'device' and base_name == 'GetDeviceProcAddr'): + table += ' table->GetDeviceProcAddr = gpa;\n' + elif (table_type != 'device' and base_name == 'GetInstanceProcAddr'): + table += ' table->GetInstanceProcAddr = gpa;\n' + else: + table += ' table->%s = (PFN_%s) gpa(%s, "%s");\n' % (base_name, item[0], table_type, item[0]) + if item[1] is not None: table += '#endif // %s\n' % item[1] table += '}' -- cgit v1.2.3