loader: Fix unknown phys dev terms on Linux
authorLenny Komow <lenny@lunarg.com>
Thu, 29 Jun 2017 17:11:16 +0000 (11:11 -0600)
committerLenny Komow <lenny@lunarg.com>
Wed, 5 Jul 2017 21:02:04 +0000 (15:02 -0600)
Change-Id: I36f683c7deb4aac27b27ca253c3324439eb2f2f2

loader/asm_offset.c
loader/phys_dev_chain.c
loader/phys_dev_chain_gas.asm
loader/phys_dev_ext.c

index 64639ae..f8b34ad 100644 (file)
@@ -101,10 +101,12 @@ int main(int argc, char **argv) {
             fprintf(file, "%-32s equ " SIZE_T_FMT "; %s\n", values[i].name, values[i].value, values[i].comment);
         }
     } else if (!strcmp(assembler, "GAS")) {
-        fprintf(file, "\n.set PHYS_DEV_DISP_OFFSET, " SIZE_T_FMT "\n", phys_dev_offset_dispatch);
 #ifdef __x86_64__
         fprintf(file, ".set X86_64, 1\n");
 #endif // __x86_64__
+        for (size_t i = 0; i < sizeof(values)/sizeof(values[0]); ++i) {
+            fprintf(file, ".set %-32s, " SIZE_T_FMT "# %s\n", values[i].name, values[i].value, values[i].comment);
+        }
     }
     return fclose(file);
 }
index f90a340..3bebf0e 100644 (file)
          disp->phys_dev_ext[num](loader_unwrap_physical_device(physical_device));          \
      }
 
+// Terminator function macro for unknown physical device extension command.
+#define PhysDevExtTermin(num)                                                                                         \
+    VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin##num(VkPhysicalDevice physical_device) {                            \
+         struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physical_device;    \
+         struct loader_icd_term *icd_term = phys_dev_term->this_icd_term;                                              \
+         struct loader_instance *inst = (struct loader_instance *)icd_term->this_instance;                             \
+         if (NULL == icd_term->phys_dev_ext[num]) {                                                                    \
+             loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "Extension %s not supported for this physical device", \
+                        inst->phys_dev_ext_disp_hash[num].func_name);                                                  \
+         }                                                                                                             \
+         icd_term->phys_dev_ext[num](phys_dev_term->phys_dev);                                                         \
+    }
+
+
+// Instantiations of the trampoline
 PhysDevExtTramp(0)
 PhysDevExtTramp(1)
 PhysDevExtTramp(2)
@@ -289,3 +304,255 @@ PhysDevExtTramp(246)
 PhysDevExtTramp(247)
 PhysDevExtTramp(248)
 PhysDevExtTramp(249)
+
+// Instantiations of the terminator
+PhysDevExtTermin(0)
+PhysDevExtTermin(1)
+PhysDevExtTermin(2)
+PhysDevExtTermin(3)
+PhysDevExtTermin(4)
+PhysDevExtTermin(5)
+PhysDevExtTermin(6)
+PhysDevExtTermin(7)
+PhysDevExtTermin(8)
+PhysDevExtTermin(9)
+PhysDevExtTermin(10)
+PhysDevExtTermin(11)
+PhysDevExtTermin(12)
+PhysDevExtTermin(13)
+PhysDevExtTermin(14)
+PhysDevExtTermin(15)
+PhysDevExtTermin(16)
+PhysDevExtTermin(17)
+PhysDevExtTermin(18)
+PhysDevExtTermin(19)
+PhysDevExtTermin(20)
+PhysDevExtTermin(21)
+PhysDevExtTermin(22)
+PhysDevExtTermin(23)
+PhysDevExtTermin(24)
+PhysDevExtTermin(25)
+PhysDevExtTermin(26)
+PhysDevExtTermin(27)
+PhysDevExtTermin(28)
+PhysDevExtTermin(29)
+PhysDevExtTermin(30)
+PhysDevExtTermin(31)
+PhysDevExtTermin(32)
+PhysDevExtTermin(33)
+PhysDevExtTermin(34)
+PhysDevExtTermin(35)
+PhysDevExtTermin(36)
+PhysDevExtTermin(37)
+PhysDevExtTermin(38)
+PhysDevExtTermin(39)
+PhysDevExtTermin(40)
+PhysDevExtTermin(41)
+PhysDevExtTermin(42)
+PhysDevExtTermin(43)
+PhysDevExtTermin(44)
+PhysDevExtTermin(45)
+PhysDevExtTermin(46)
+PhysDevExtTermin(47)
+PhysDevExtTermin(48)
+PhysDevExtTermin(49)
+PhysDevExtTermin(50)
+PhysDevExtTermin(51)
+PhysDevExtTermin(52)
+PhysDevExtTermin(53)
+PhysDevExtTermin(54)
+PhysDevExtTermin(55)
+PhysDevExtTermin(56)
+PhysDevExtTermin(57)
+PhysDevExtTermin(58)
+PhysDevExtTermin(59)
+PhysDevExtTermin(60)
+PhysDevExtTermin(61)
+PhysDevExtTermin(62)
+PhysDevExtTermin(63)
+PhysDevExtTermin(64)
+PhysDevExtTermin(65)
+PhysDevExtTermin(66)
+PhysDevExtTermin(67)
+PhysDevExtTermin(68)
+PhysDevExtTermin(69)
+PhysDevExtTermin(70)
+PhysDevExtTermin(71)
+PhysDevExtTermin(72)
+PhysDevExtTermin(73)
+PhysDevExtTermin(74)
+PhysDevExtTermin(75)
+PhysDevExtTermin(76)
+PhysDevExtTermin(77)
+PhysDevExtTermin(78)
+PhysDevExtTermin(79)
+PhysDevExtTermin(80)
+PhysDevExtTermin(81)
+PhysDevExtTermin(82)
+PhysDevExtTermin(83)
+PhysDevExtTermin(84)
+PhysDevExtTermin(85)
+PhysDevExtTermin(86)
+PhysDevExtTermin(87)
+PhysDevExtTermin(88)
+PhysDevExtTermin(89)
+PhysDevExtTermin(90)
+PhysDevExtTermin(91)
+PhysDevExtTermin(92)
+PhysDevExtTermin(93)
+PhysDevExtTermin(94)
+PhysDevExtTermin(95)
+PhysDevExtTermin(96)
+PhysDevExtTermin(97)
+PhysDevExtTermin(98)
+PhysDevExtTermin(99)
+PhysDevExtTermin(100)
+PhysDevExtTermin(101)
+PhysDevExtTermin(102)
+PhysDevExtTermin(103)
+PhysDevExtTermin(104)
+PhysDevExtTermin(105)
+PhysDevExtTermin(106)
+PhysDevExtTermin(107)
+PhysDevExtTermin(108)
+PhysDevExtTermin(109)
+PhysDevExtTermin(110)
+PhysDevExtTermin(111)
+PhysDevExtTermin(112)
+PhysDevExtTermin(113)
+PhysDevExtTermin(114)
+PhysDevExtTermin(115)
+PhysDevExtTermin(116)
+PhysDevExtTermin(117)
+PhysDevExtTermin(118)
+PhysDevExtTermin(119)
+PhysDevExtTermin(120)
+PhysDevExtTermin(121)
+PhysDevExtTermin(122)
+PhysDevExtTermin(123)
+PhysDevExtTermin(124)
+PhysDevExtTermin(125)
+PhysDevExtTermin(126)
+PhysDevExtTermin(127)
+PhysDevExtTermin(128)
+PhysDevExtTermin(129)
+PhysDevExtTermin(130)
+PhysDevExtTermin(131)
+PhysDevExtTermin(132)
+PhysDevExtTermin(133)
+PhysDevExtTermin(134)
+PhysDevExtTermin(135)
+PhysDevExtTermin(136)
+PhysDevExtTermin(137)
+PhysDevExtTermin(138)
+PhysDevExtTermin(139)
+PhysDevExtTermin(140)
+PhysDevExtTermin(141)
+PhysDevExtTermin(142)
+PhysDevExtTermin(143)
+PhysDevExtTermin(144)
+PhysDevExtTermin(145)
+PhysDevExtTermin(146)
+PhysDevExtTermin(147)
+PhysDevExtTermin(148)
+PhysDevExtTermin(149)
+PhysDevExtTermin(150)
+PhysDevExtTermin(151)
+PhysDevExtTermin(152)
+PhysDevExtTermin(153)
+PhysDevExtTermin(154)
+PhysDevExtTermin(155)
+PhysDevExtTermin(156)
+PhysDevExtTermin(157)
+PhysDevExtTermin(158)
+PhysDevExtTermin(159)
+PhysDevExtTermin(160)
+PhysDevExtTermin(161)
+PhysDevExtTermin(162)
+PhysDevExtTermin(163)
+PhysDevExtTermin(164)
+PhysDevExtTermin(165)
+PhysDevExtTermin(166)
+PhysDevExtTermin(167)
+PhysDevExtTermin(168)
+PhysDevExtTermin(169)
+PhysDevExtTermin(170)
+PhysDevExtTermin(171)
+PhysDevExtTermin(172)
+PhysDevExtTermin(173)
+PhysDevExtTermin(174)
+PhysDevExtTermin(175)
+PhysDevExtTermin(176)
+PhysDevExtTermin(177)
+PhysDevExtTermin(178)
+PhysDevExtTermin(179)
+PhysDevExtTermin(180)
+PhysDevExtTermin(181)
+PhysDevExtTermin(182)
+PhysDevExtTermin(183)
+PhysDevExtTermin(184)
+PhysDevExtTermin(185)
+PhysDevExtTermin(186)
+PhysDevExtTermin(187)
+PhysDevExtTermin(188)
+PhysDevExtTermin(189)
+PhysDevExtTermin(190)
+PhysDevExtTermin(191)
+PhysDevExtTermin(192)
+PhysDevExtTermin(193)
+PhysDevExtTermin(194)
+PhysDevExtTermin(195)
+PhysDevExtTermin(196)
+PhysDevExtTermin(197)
+PhysDevExtTermin(198)
+PhysDevExtTermin(199)
+PhysDevExtTermin(200)
+PhysDevExtTermin(201)
+PhysDevExtTermin(202)
+PhysDevExtTermin(203)
+PhysDevExtTermin(204)
+PhysDevExtTermin(205)
+PhysDevExtTermin(206)
+PhysDevExtTermin(207)
+PhysDevExtTermin(208)
+PhysDevExtTermin(209)
+PhysDevExtTermin(210)
+PhysDevExtTermin(211)
+PhysDevExtTermin(212)
+PhysDevExtTermin(213)
+PhysDevExtTermin(214)
+PhysDevExtTermin(215)
+PhysDevExtTermin(216)
+PhysDevExtTermin(217)
+PhysDevExtTermin(218)
+PhysDevExtTermin(219)
+PhysDevExtTermin(220)
+PhysDevExtTermin(221)
+PhysDevExtTermin(222)
+PhysDevExtTermin(223)
+PhysDevExtTermin(224)
+PhysDevExtTermin(225)
+PhysDevExtTermin(226)
+PhysDevExtTermin(227)
+PhysDevExtTermin(228)
+PhysDevExtTermin(229)
+PhysDevExtTermin(230)
+PhysDevExtTermin(231)
+PhysDevExtTermin(232)
+PhysDevExtTermin(233)
+PhysDevExtTermin(234)
+PhysDevExtTermin(235)
+PhysDevExtTermin(236)
+PhysDevExtTermin(237)
+PhysDevExtTermin(238)
+PhysDevExtTermin(239)
+PhysDevExtTermin(240)
+PhysDevExtTermin(241)
+PhysDevExtTermin(242)
+PhysDevExtTermin(243)
+PhysDevExtTermin(244)
+PhysDevExtTermin(245)
+PhysDevExtTermin(246)
+PhysDevExtTermin(247)
+PhysDevExtTermin(248)
+PhysDevExtTermin(249)
index b3d195e..78d8442 100644 (file)
 
 .ifdef X86_64
 
-.set PHYS_DEV_SIZE, 8
-.set PHYS_DEV_UNWRAP_OFFSET, 16
-.set PTR_SIZE, 8
-
 .macro PhysDevExtTramp num
 .global vkPhysDevExtTramp\num
 vkPhysDevExtTramp\num:
     mov     rax, [rdi]
-    mov     rdi, [rdi + PHYS_DEV_UNWRAP_OFFSET]
-    jmp     [rax + (PHYS_DEV_DISP_OFFSET + (PTR_SIZE * \num))]
+    mov     rdi, [rdi + PHYS_DEV_OFFSET_PHYS_DEV_TRAMP]
+    jmp     [rax + (PHYS_DEV_OFFSET_INST_DISPATCH + (PTR_SIZE * \num))]
 .endm
 
-.else
-# NOTE: The 32-bit code has not been properly tested, so it likely won't work
+.macro PhysDevExtTermin num
+.global vkPhysDevExtTermin\num
+vkPhysDevExtTermin\num:
+    mov     rax, [rdi + ICD_TERM_OFFSET_PHYS_DEV_TERM]                          # Store the loader_icd_term* in rax
+    cmp     qword ptr [rax + (DISPATCH_OFFSET_ICD_TERM + (PTR_SIZE * \num))], 0 # Check if the next function in the chain is NULL
+    je      terminError\num                                                     # Go to the error section if it is NULL
+    mov     rdi, [rdi + PHYS_DEV_OFFSET_PHYS_DEV_TERM]                          # Load the unwrapped VkPhysicalDevice into the first arg
+    jmp     [rax + (DISPATCH_OFFSET_ICD_TERM + (PTR_SIZE * \num))]              # Jump to the next function in the chain
+terminError\num:
+    sub     rsp, 56                                                             # Create the stack frame
+    mov     rdi, [rax + INSTANCE_OFFSET_ICD_TERM]                               # Load the loader_instance into rdi (first arg)
+    mov     r8, [rdi + (HASH_OFFSET_INSTANCE + (HASH_SIZE * \num) + FUNC_NAME_OFFSET_HASH)] # Load the func name into r8 (fifth arg)
+    lea     rcx, termin_error_string@GOTPCREL                                   # Load the error string into rcx (fourth arg)
+    xor     edx, edx                                                            # Set rdx to zero (third arg)
+    lea     esi, [rdx + VK_DEBUG_REPORT_ERROR_BIT_EXT]                          # Write the error logging bit to rsi (second arg)
+    call    loader_log                                                          # Log the error message before we crash
+    add     rsp, 56                                                             # Clean up the stack frame
+    mov     rax, 0
+    jmp     rax                                                                 # Crash intentionally by jumping to address zero
+.endm
 
-.set PHYS_DEV_SIZE, 4
-.set PHYS_DEV_UNWRAP_OFFSET, 8
-.set PTR_SIZE, 4
+.else
 
 .macro PhysDevExtTramp num
 .global vkPhysDevExtTramp\num
 vkPhysDevExtTramp\num:
-    mov     eax, [esp + PHYS_DEV_SIZE]                  # Load the wrapped VkPhysicalDevice into eax
-    mov     ecx, [eax + PHYS_DEV_UNWRAP_OFFSET]         # Load the unwrapped VkPhysicalDevice into ecx
-    mov     [esp + PHYS_DEV_SIZE], ecx                  # Overwrite the wrapped VkPhysicalDevice with the unwrapped one (on the stack)
+    mov     eax, [esp + 4]                              # Load the wrapped VkPhysicalDevice into eax
+    mov     ecx, [eax + PHYS_DEV_OFFSET_PHYS_DEV_TRAMP] # Load the unwrapped VkPhysicalDevice into ecx
+    mov     [esp + 4], ecx                              # Overwrite the wrapped VkPhysicalDevice with the unwrapped one (on the stack)
     mov     eax, [eax]                                  # Dereference the wrapped VkPhysicalDevice to get the dispatch table in eax
-    jmp     [eax + (PHYS_DEV_DISP_OFFSET + (PTR_SIZE * \num))] # Dereference the wrapped VkPhysicalDevice to get the dispatch table in eax
+    jmp     [eax + (PHYS_DEV_OFFSET_INST_DISPATCH + (PTR_SIZE * \num))] # Dereference the wrapped VkPhysicalDevice to get the dispatch table in eax
+.endm
+
+.macro PhysDevExtTermin num
+.global vkPhysDevExtTermin\num
+vkPhysDevExtTermin\num:
+    mov     ecx, [esp + 4]                                                      # Move the wrapped VkPhysicalDevice into ecx
+    mov     eax, [ecx + ICD_TERM_OFFSET_PHYS_DEV_TERM]                          # Store the loader_icd_term* in eax
+    cmp     dword ptr [eax + (DISPATCH_OFFSET_ICD_TERM + (PTR_SIZE * \num))], 0 # Check if the next function in the chain is NULL
+    je      terminError\num                                                     # Go to the error section if it is NULL
+    mov     ecx, [ecx + PHYS_DEV_OFFSET_PHYS_DEV_TERM]                          # Unwrap the VkPhysicalDevice in ecx
+    mov     [esp + 4], ecx                                                      # Copy the unwrapped VkPhysicalDevice into the first arg
+    jmp     [eax + (DISPATCH_OFFSET_ICD_TERM + (PTR_SIZE * \num))]              # Jump to the next function in the chain
+terminError\num:
+    mov     eax, [eax + INSTANCE_OFFSET_ICD_TERM]                               # Load the loader_instance into eax
+    push    [eax + (HASH_OFFSET_INSTANCE + (HASH_SIZE * \num) + FUNC_NAME_OFFSET_HASH)] # Push the func name (fifth arg)
+    push    offset termin_error_string                                          # Push the error string (fourth arg)
+    push    0                                                                   # Push zero (third arg)
+    push    VK_DEBUG_REPORT_ERROR_BIT_EXT                                       # Push the error logging bit (second arg)
+    push    eax                                                                 # Push the loader_instance (first arg)
+    call    loader_log                                                          # Log the error message before we crash
+    add     esp, 20                                                             # Clean up the args
+    mov     eax, 0
+    jmp     eax                                                                 # Crash intentionally by jumping to address zero
 .endm
 
 .endif
 
+.data
+
+termin_error_string:
+.string "Extension %s not supported for this physical device"
+
 .text
 
     PhysDevExtTramp 0
@@ -310,3 +350,254 @@ vkPhysDevExtTramp\num:
     PhysDevExtTramp 247
     PhysDevExtTramp 248
     PhysDevExtTramp 249
+
+    PhysDevExtTermin 0
+    PhysDevExtTermin 1
+    PhysDevExtTermin 2
+    PhysDevExtTermin 3
+    PhysDevExtTermin 4
+    PhysDevExtTermin 5
+    PhysDevExtTermin 6
+    PhysDevExtTermin 7
+    PhysDevExtTermin 8
+    PhysDevExtTermin 9
+    PhysDevExtTermin 10
+    PhysDevExtTermin 11
+    PhysDevExtTermin 12
+    PhysDevExtTermin 13
+    PhysDevExtTermin 14
+    PhysDevExtTermin 15
+    PhysDevExtTermin 16
+    PhysDevExtTermin 17
+    PhysDevExtTermin 18
+    PhysDevExtTermin 19
+    PhysDevExtTermin 20
+    PhysDevExtTermin 21
+    PhysDevExtTermin 22
+    PhysDevExtTermin 23
+    PhysDevExtTermin 24
+    PhysDevExtTermin 25
+    PhysDevExtTermin 26
+    PhysDevExtTermin 27
+    PhysDevExtTermin 28
+    PhysDevExtTermin 29
+    PhysDevExtTermin 30
+    PhysDevExtTermin 31
+    PhysDevExtTermin 32
+    PhysDevExtTermin 33
+    PhysDevExtTermin 34
+    PhysDevExtTermin 35
+    PhysDevExtTermin 36
+    PhysDevExtTermin 37
+    PhysDevExtTermin 38
+    PhysDevExtTermin 39
+    PhysDevExtTermin 40
+    PhysDevExtTermin 41
+    PhysDevExtTermin 42
+    PhysDevExtTermin 43
+    PhysDevExtTermin 44
+    PhysDevExtTermin 45
+    PhysDevExtTermin 46
+    PhysDevExtTermin 47
+    PhysDevExtTermin 48
+    PhysDevExtTermin 49
+    PhysDevExtTermin 50
+    PhysDevExtTermin 51
+    PhysDevExtTermin 52
+    PhysDevExtTermin 53
+    PhysDevExtTermin 54
+    PhysDevExtTermin 55
+    PhysDevExtTermin 56
+    PhysDevExtTermin 57
+    PhysDevExtTermin 58
+    PhysDevExtTermin 59
+    PhysDevExtTermin 60
+    PhysDevExtTermin 61
+    PhysDevExtTermin 62
+    PhysDevExtTermin 63
+    PhysDevExtTermin 64
+    PhysDevExtTermin 65
+    PhysDevExtTermin 66
+    PhysDevExtTermin 67
+    PhysDevExtTermin 68
+    PhysDevExtTermin 69
+    PhysDevExtTermin 70
+    PhysDevExtTermin 71
+    PhysDevExtTermin 72
+    PhysDevExtTermin 73
+    PhysDevExtTermin 74
+    PhysDevExtTermin 75
+    PhysDevExtTermin 76
+    PhysDevExtTermin 77
+    PhysDevExtTermin 78
+    PhysDevExtTermin 79
+    PhysDevExtTermin 80
+    PhysDevExtTermin 81
+    PhysDevExtTermin 82
+    PhysDevExtTermin 83
+    PhysDevExtTermin 84
+    PhysDevExtTermin 85
+    PhysDevExtTermin 86
+    PhysDevExtTermin 87
+    PhysDevExtTermin 88
+    PhysDevExtTermin 89
+    PhysDevExtTermin 90
+    PhysDevExtTermin 91
+    PhysDevExtTermin 92
+    PhysDevExtTermin 93
+    PhysDevExtTermin 94
+    PhysDevExtTermin 95
+    PhysDevExtTermin 96
+    PhysDevExtTermin 97
+    PhysDevExtTermin 98
+    PhysDevExtTermin 99
+    PhysDevExtTermin 100
+    PhysDevExtTermin 101
+    PhysDevExtTermin 102
+    PhysDevExtTermin 103
+    PhysDevExtTermin 104
+    PhysDevExtTermin 105
+    PhysDevExtTermin 106
+    PhysDevExtTermin 107
+    PhysDevExtTermin 108
+    PhysDevExtTermin 109
+    PhysDevExtTermin 110
+    PhysDevExtTermin 111
+    PhysDevExtTermin 112
+    PhysDevExtTermin 113
+    PhysDevExtTermin 114
+    PhysDevExtTermin 115
+    PhysDevExtTermin 116
+    PhysDevExtTermin 117
+    PhysDevExtTermin 118
+    PhysDevExtTermin 119
+    PhysDevExtTermin 120
+    PhysDevExtTermin 121
+    PhysDevExtTermin 122
+    PhysDevExtTermin 123
+    PhysDevExtTermin 124
+    PhysDevExtTermin 125
+    PhysDevExtTermin 126
+    PhysDevExtTermin 127
+    PhysDevExtTermin 128
+    PhysDevExtTermin 129
+    PhysDevExtTermin 130
+    PhysDevExtTermin 131
+    PhysDevExtTermin 132
+    PhysDevExtTermin 133
+    PhysDevExtTermin 134
+    PhysDevExtTermin 135
+    PhysDevExtTermin 136
+    PhysDevExtTermin 137
+    PhysDevExtTermin 138
+    PhysDevExtTermin 139
+    PhysDevExtTermin 140
+    PhysDevExtTermin 141
+    PhysDevExtTermin 142
+    PhysDevExtTermin 143
+    PhysDevExtTermin 144
+    PhysDevExtTermin 145
+    PhysDevExtTermin 146
+    PhysDevExtTermin 147
+    PhysDevExtTermin 148
+    PhysDevExtTermin 149
+    PhysDevExtTermin 150
+    PhysDevExtTermin 151
+    PhysDevExtTermin 152
+    PhysDevExtTermin 153
+    PhysDevExtTermin 154
+    PhysDevExtTermin 155
+    PhysDevExtTermin 156
+    PhysDevExtTermin 157
+    PhysDevExtTermin 158
+    PhysDevExtTermin 159
+    PhysDevExtTermin 160
+    PhysDevExtTermin 161
+    PhysDevExtTermin 162
+    PhysDevExtTermin 163
+    PhysDevExtTermin 164
+    PhysDevExtTermin 165
+    PhysDevExtTermin 166
+    PhysDevExtTermin 167
+    PhysDevExtTermin 168
+    PhysDevExtTermin 169
+    PhysDevExtTermin 170
+    PhysDevExtTermin 171
+    PhysDevExtTermin 172
+    PhysDevExtTermin 173
+    PhysDevExtTermin 174
+    PhysDevExtTermin 175
+    PhysDevExtTermin 176
+    PhysDevExtTermin 177
+    PhysDevExtTermin 178
+    PhysDevExtTermin 179
+    PhysDevExtTermin 180
+    PhysDevExtTermin 181
+    PhysDevExtTermin 182
+    PhysDevExtTermin 183
+    PhysDevExtTermin 184
+    PhysDevExtTermin 185
+    PhysDevExtTermin 186
+    PhysDevExtTermin 187
+    PhysDevExtTermin 188
+    PhysDevExtTermin 189
+    PhysDevExtTermin 190
+    PhysDevExtTermin 191
+    PhysDevExtTermin 192
+    PhysDevExtTermin 193
+    PhysDevExtTermin 194
+    PhysDevExtTermin 195
+    PhysDevExtTermin 196
+    PhysDevExtTermin 197
+    PhysDevExtTermin 198
+    PhysDevExtTermin 199
+    PhysDevExtTermin 200
+    PhysDevExtTermin 201
+    PhysDevExtTermin 202
+    PhysDevExtTermin 203
+    PhysDevExtTermin 204
+    PhysDevExtTermin 205
+    PhysDevExtTermin 206
+    PhysDevExtTermin 207
+    PhysDevExtTermin 208
+    PhysDevExtTermin 209
+    PhysDevExtTermin 210
+    PhysDevExtTermin 211
+    PhysDevExtTermin 212
+    PhysDevExtTermin 213
+    PhysDevExtTermin 214
+    PhysDevExtTermin 215
+    PhysDevExtTermin 216
+    PhysDevExtTermin 217
+    PhysDevExtTermin 218
+    PhysDevExtTermin 219
+    PhysDevExtTermin 220
+    PhysDevExtTermin 221
+    PhysDevExtTermin 222
+    PhysDevExtTermin 223
+    PhysDevExtTermin 224
+    PhysDevExtTermin 225
+    PhysDevExtTermin 226
+    PhysDevExtTermin 227
+    PhysDevExtTermin 228
+    PhysDevExtTermin 229
+    PhysDevExtTermin 230
+    PhysDevExtTermin 231
+    PhysDevExtTermin 232
+    PhysDevExtTermin 233
+    PhysDevExtTermin 234
+    PhysDevExtTermin 235
+    PhysDevExtTermin 236
+    PhysDevExtTermin 237
+    PhysDevExtTermin 238
+    PhysDevExtTermin 239
+    PhysDevExtTermin 240
+    PhysDevExtTermin 241
+    PhysDevExtTermin 242
+    PhysDevExtTermin 243
+    PhysDevExtTermin 244
+    PhysDevExtTermin 245
+    PhysDevExtTermin 246
+    PhysDevExtTermin 247
+    PhysDevExtTermin 248
+    PhysDevExtTermin 249
index a83467f..91e0ef8 100644 (file)
 #pragma GCC optimize(3)  // force gcc to use tail-calls
 #endif
 
-// Terminator function macro for unknown physical device extension command.
-#define PhysDevExtTermin(num)                                                                                         \
-    VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin##num(VkPhysicalDevice physical_device) {                            \
-        struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physical_device;    \
-        struct loader_icd_term *icd_term = phys_dev_term->this_icd_term;                                              \
-        struct loader_instance *inst = (struct loader_instance *)icd_term->this_instance;                             \
-        if (NULL == icd_term->phys_dev_ext[num]) {                                                                    \
-            loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "Extension %s not supported for this physical device", \
-                       inst->phys_dev_ext_disp_hash[num].func_name);                                                  \
-        }                                                                                                             \
-        icd_term->phys_dev_ext[num](phys_dev_term->phys_dev);                                                         \
-    }
-
 // Declarations for the trampoline
 VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp0(VkPhysicalDevice);
 VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp1(VkPhysicalDevice);
@@ -302,7 +289,6 @@ VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp249(VkPhysicalDevice);
 // Disable clang-format for lists of macros
 // clang-format off
 
-#if defined(_WIN32)
 VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin0(VkPhysicalDevice);
 VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin1(VkPhysicalDevice);
 VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin2(VkPhysicalDevice);
@@ -553,259 +539,6 @@ VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin246(VkPhysicalDevice);
 VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin247(VkPhysicalDevice);
 VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin248(VkPhysicalDevice);
 VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin249(VkPhysicalDevice);
-#else
-// Instantiations of the terminator
-PhysDevExtTermin(0)
-PhysDevExtTermin(1)
-PhysDevExtTermin(2)
-PhysDevExtTermin(3)
-PhysDevExtTermin(4)
-PhysDevExtTermin(5)
-PhysDevExtTermin(6)
-PhysDevExtTermin(7)
-PhysDevExtTermin(8)
-PhysDevExtTermin(9)
-PhysDevExtTermin(10)
-PhysDevExtTermin(11)
-PhysDevExtTermin(12)
-PhysDevExtTermin(13)
-PhysDevExtTermin(14)
-PhysDevExtTermin(15)
-PhysDevExtTermin(16)
-PhysDevExtTermin(17)
-PhysDevExtTermin(18)
-PhysDevExtTermin(19)
-PhysDevExtTermin(20)
-PhysDevExtTermin(21)
-PhysDevExtTermin(22)
-PhysDevExtTermin(23)
-PhysDevExtTermin(24)
-PhysDevExtTermin(25)
-PhysDevExtTermin(26)
-PhysDevExtTermin(27)
-PhysDevExtTermin(28)
-PhysDevExtTermin(29)
-PhysDevExtTermin(30)
-PhysDevExtTermin(31)
-PhysDevExtTermin(32)
-PhysDevExtTermin(33)
-PhysDevExtTermin(34)
-PhysDevExtTermin(35)
-PhysDevExtTermin(36)
-PhysDevExtTermin(37)
-PhysDevExtTermin(38)
-PhysDevExtTermin(39)
-PhysDevExtTermin(40)
-PhysDevExtTermin(41)
-PhysDevExtTermin(42)
-PhysDevExtTermin(43)
-PhysDevExtTermin(44)
-PhysDevExtTermin(45)
-PhysDevExtTermin(46)
-PhysDevExtTermin(47)
-PhysDevExtTermin(48)
-PhysDevExtTermin(49)
-PhysDevExtTermin(50)
-PhysDevExtTermin(51)
-PhysDevExtTermin(52)
-PhysDevExtTermin(53)
-PhysDevExtTermin(54)
-PhysDevExtTermin(55)
-PhysDevExtTermin(56)
-PhysDevExtTermin(57)
-PhysDevExtTermin(58)
-PhysDevExtTermin(59)
-PhysDevExtTermin(60)
-PhysDevExtTermin(61)
-PhysDevExtTermin(62)
-PhysDevExtTermin(63)
-PhysDevExtTermin(64)
-PhysDevExtTermin(65)
-PhysDevExtTermin(66)
-PhysDevExtTermin(67)
-PhysDevExtTermin(68)
-PhysDevExtTermin(69)
-PhysDevExtTermin(70)
-PhysDevExtTermin(71)
-PhysDevExtTermin(72)
-PhysDevExtTermin(73)
-PhysDevExtTermin(74)
-PhysDevExtTermin(75)
-PhysDevExtTermin(76)
-PhysDevExtTermin(77)
-PhysDevExtTermin(78)
-PhysDevExtTermin(79)
-PhysDevExtTermin(80)
-PhysDevExtTermin(81)
-PhysDevExtTermin(82)
-PhysDevExtTermin(83)
-PhysDevExtTermin(84)
-PhysDevExtTermin(85)
-PhysDevExtTermin(86)
-PhysDevExtTermin(87)
-PhysDevExtTermin(88)
-PhysDevExtTermin(89)
-PhysDevExtTermin(90)
-PhysDevExtTermin(91)
-PhysDevExtTermin(92)
-PhysDevExtTermin(93)
-PhysDevExtTermin(94)
-PhysDevExtTermin(95)
-PhysDevExtTermin(96)
-PhysDevExtTermin(97)
-PhysDevExtTermin(98)
-PhysDevExtTermin(99)
-PhysDevExtTermin(100)
-PhysDevExtTermin(101)
-PhysDevExtTermin(102)
-PhysDevExtTermin(103)
-PhysDevExtTermin(104)
-PhysDevExtTermin(105)
-PhysDevExtTermin(106)
-PhysDevExtTermin(107)
-PhysDevExtTermin(108)
-PhysDevExtTermin(109)
-PhysDevExtTermin(110)
-PhysDevExtTermin(111)
-PhysDevExtTermin(112)
-PhysDevExtTermin(113)
-PhysDevExtTermin(114)
-PhysDevExtTermin(115)
-PhysDevExtTermin(116)
-PhysDevExtTermin(117)
-PhysDevExtTermin(118)
-PhysDevExtTermin(119)
-PhysDevExtTermin(120)
-PhysDevExtTermin(121)
-PhysDevExtTermin(122)
-PhysDevExtTermin(123)
-PhysDevExtTermin(124)
-PhysDevExtTermin(125)
-PhysDevExtTermin(126)
-PhysDevExtTermin(127)
-PhysDevExtTermin(128)
-PhysDevExtTermin(129)
-PhysDevExtTermin(130)
-PhysDevExtTermin(131)
-PhysDevExtTermin(132)
-PhysDevExtTermin(133)
-PhysDevExtTermin(134)
-PhysDevExtTermin(135)
-PhysDevExtTermin(136)
-PhysDevExtTermin(137)
-PhysDevExtTermin(138)
-PhysDevExtTermin(139)
-PhysDevExtTermin(140)
-PhysDevExtTermin(141)
-PhysDevExtTermin(142)
-PhysDevExtTermin(143)
-PhysDevExtTermin(144)
-PhysDevExtTermin(145)
-PhysDevExtTermin(146)
-PhysDevExtTermin(147)
-PhysDevExtTermin(148)
-PhysDevExtTermin(149)
-PhysDevExtTermin(150)
-PhysDevExtTermin(151)
-PhysDevExtTermin(152)
-PhysDevExtTermin(153)
-PhysDevExtTermin(154)
-PhysDevExtTermin(155)
-PhysDevExtTermin(156)
-PhysDevExtTermin(157)
-PhysDevExtTermin(158)
-PhysDevExtTermin(159)
-PhysDevExtTermin(160)
-PhysDevExtTermin(161)
-PhysDevExtTermin(162)
-PhysDevExtTermin(163)
-PhysDevExtTermin(164)
-PhysDevExtTermin(165)
-PhysDevExtTermin(166)
-PhysDevExtTermin(167)
-PhysDevExtTermin(168)
-PhysDevExtTermin(169)
-PhysDevExtTermin(170)
-PhysDevExtTermin(171)
-PhysDevExtTermin(172)
-PhysDevExtTermin(173)
-PhysDevExtTermin(174)
-PhysDevExtTermin(175)
-PhysDevExtTermin(176)
-PhysDevExtTermin(177)
-PhysDevExtTermin(178)
-PhysDevExtTermin(179)
-PhysDevExtTermin(180)
-PhysDevExtTermin(181)
-PhysDevExtTermin(182)
-PhysDevExtTermin(183)
-PhysDevExtTermin(184)
-PhysDevExtTermin(185)
-PhysDevExtTermin(186)
-PhysDevExtTermin(187)
-PhysDevExtTermin(188)
-PhysDevExtTermin(189)
-PhysDevExtTermin(190)
-PhysDevExtTermin(191)
-PhysDevExtTermin(192)
-PhysDevExtTermin(193)
-PhysDevExtTermin(194)
-PhysDevExtTermin(195)
-PhysDevExtTermin(196)
-PhysDevExtTermin(197)
-PhysDevExtTermin(198)
-PhysDevExtTermin(199)
-PhysDevExtTermin(200)
-PhysDevExtTermin(201)
-PhysDevExtTermin(202)
-PhysDevExtTermin(203)
-PhysDevExtTermin(204)
-PhysDevExtTermin(205)
-PhysDevExtTermin(206)
-PhysDevExtTermin(207)
-PhysDevExtTermin(208)
-PhysDevExtTermin(209)
-PhysDevExtTermin(210)
-PhysDevExtTermin(211)
-PhysDevExtTermin(212)
-PhysDevExtTermin(213)
-PhysDevExtTermin(214)
-PhysDevExtTermin(215)
-PhysDevExtTermin(216)
-PhysDevExtTermin(217)
-PhysDevExtTermin(218)
-PhysDevExtTermin(219)
-PhysDevExtTermin(220)
-PhysDevExtTermin(221)
-PhysDevExtTermin(222)
-PhysDevExtTermin(223)
-PhysDevExtTermin(224)
-PhysDevExtTermin(225)
-PhysDevExtTermin(226)
-PhysDevExtTermin(227)
-PhysDevExtTermin(228)
-PhysDevExtTermin(229)
-PhysDevExtTermin(230)
-PhysDevExtTermin(231)
-PhysDevExtTermin(232)
-PhysDevExtTermin(233)
-PhysDevExtTermin(234)
-PhysDevExtTermin(235)
-PhysDevExtTermin(236)
-PhysDevExtTermin(237)
-PhysDevExtTermin(238)
-PhysDevExtTermin(239)
-PhysDevExtTermin(240)
-PhysDevExtTermin(241)
-PhysDevExtTermin(242)
-PhysDevExtTermin(243)
-PhysDevExtTermin(244)
-PhysDevExtTermin(245)
-PhysDevExtTermin(246)
-PhysDevExtTermin(247)
-PhysDevExtTermin(248)
-PhysDevExtTermin(249)
-#endif
 
 
 void *loader_get_phys_dev_ext_tramp(uint32_t index) {