Add guard for GetPhysDevProcAddr typedef
authorCharles Giessen <charles@lunarg.com>
Mon, 16 Jan 2023 05:32:01 +0000 (22:32 -0700)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Mon, 16 Jan 2023 05:45:14 +0000 (22:45 -0700)
vk_layer_dispatch_table.h may be included after vk_icd.h and may cause multiple
definitions. This commit adds a macro guard on whether the type is defined just
in case.

loader/generated/vk_layer_dispatch_table.h
scripts/loader_extension_generator.py

index 2171cff848253d292296afd34a6616f916d73e3a..95b47171d5d5798ed005ec9fd8ba6cd2d7f4c41e 100644 (file)
@@ -24,7 +24,9 @@
 
 #pragma once
 
+#ifndef PFN_GetPhysicalDeviceProcAddr
 typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
+#endif
 
 // Instance function pointer dispatch table
 typedef struct VkLayerInstanceDispatchTable_ {
index e5a4ca88223c5647540e625f32ce4e04074b1ab2..31417fe4bb1fc3e53a1ed4029e13406105cc3523 100644 (file)
@@ -226,7 +226,9 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         elif self.genOpts.filename == 'vk_layer_dispatch_table.h':
             preamble += '#pragma once\n'
             preamble += '\n'
+            preamble += '#ifndef PFN_GetPhysicalDeviceProcAddr\n'
             preamble += 'typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);\n'
+            preamble += '#endif\n'
 
         write(copyright, file=self.outFile)
         write(preamble, file=self.outFile)