• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright (c) 2015-2021 The Khronos Group Inc.
4  * Copyright (c) 2015-2021 Valve Corporation
5  * Copyright (c) 2015-2021 LunarG, Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * Author: Jon Ashburn <jon@lunarg.com>
20  * Author: Charles Giessen <charles@lunarg.com>
21  */
22 
23 #include "gpa_helper.h"
24 
25 #include <string.h>
26 
27 #include "loader.h"
28 #include "debug_utils.h"
29 #include "unknown_function_handling.h"
30 #include "wsi.h"
31 
trampoline_get_proc_addr(struct loader_instance * inst,const char * funcName)32 void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcName) {
33     // Don't include or check global functions
34     if (!strcmp(funcName, "vkGetInstanceProcAddr")) return vkGetInstanceProcAddr;
35     if (!strcmp(funcName, "vkDestroyInstance")) return vkDestroyInstance;
36     if (!strcmp(funcName, "vkEnumeratePhysicalDevices")) return vkEnumeratePhysicalDevices;
37     if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures")) return vkGetPhysicalDeviceFeatures;
38     if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties")) return vkGetPhysicalDeviceFormatProperties;
39     if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties")) return vkGetPhysicalDeviceImageFormatProperties;
40     if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties")) return vkGetPhysicalDeviceSparseImageFormatProperties;
41     if (!strcmp(funcName, "vkGetPhysicalDeviceProperties")) return vkGetPhysicalDeviceProperties;
42     if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties")) return vkGetPhysicalDeviceQueueFamilyProperties;
43     if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties")) return vkGetPhysicalDeviceMemoryProperties;
44     if (!strcmp(funcName, "vkEnumerateDeviceLayerProperties")) return vkEnumerateDeviceLayerProperties;
45     if (!strcmp(funcName, "vkEnumerateDeviceExtensionProperties")) return vkEnumerateDeviceExtensionProperties;
46     if (!strcmp(funcName, "vkCreateDevice")) return vkCreateDevice;
47     if (!strcmp(funcName, "vkGetDeviceProcAddr")) return vkGetDeviceProcAddr;
48     if (!strcmp(funcName, "vkDestroyDevice")) return vkDestroyDevice;
49     if (!strcmp(funcName, "vkGetDeviceQueue")) return vkGetDeviceQueue;
50     if (!strcmp(funcName, "vkQueueSubmit")) return vkQueueSubmit;
51     if (!strcmp(funcName, "vkQueueWaitIdle")) return vkQueueWaitIdle;
52     if (!strcmp(funcName, "vkDeviceWaitIdle")) return vkDeviceWaitIdle;
53     if (!strcmp(funcName, "vkAllocateMemory")) return vkAllocateMemory;
54     if (!strcmp(funcName, "vkFreeMemory")) return vkFreeMemory;
55     if (!strcmp(funcName, "vkMapMemory")) return vkMapMemory;
56     if (!strcmp(funcName, "vkUnmapMemory")) return vkUnmapMemory;
57     if (!strcmp(funcName, "vkFlushMappedMemoryRanges")) return vkFlushMappedMemoryRanges;
58     if (!strcmp(funcName, "vkInvalidateMappedMemoryRanges")) return vkInvalidateMappedMemoryRanges;
59     if (!strcmp(funcName, "vkGetDeviceMemoryCommitment")) return vkGetDeviceMemoryCommitment;
60     if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements")) return vkGetImageSparseMemoryRequirements;
61     if (!strcmp(funcName, "vkGetImageMemoryRequirements")) return vkGetImageMemoryRequirements;
62     if (!strcmp(funcName, "vkGetBufferMemoryRequirements")) return vkGetBufferMemoryRequirements;
63     if (!strcmp(funcName, "vkBindImageMemory")) return vkBindImageMemory;
64     if (!strcmp(funcName, "vkBindBufferMemory")) return vkBindBufferMemory;
65     if (!strcmp(funcName, "vkQueueBindSparse")) return vkQueueBindSparse;
66     if (!strcmp(funcName, "vkCreateFence")) return vkCreateFence;
67     if (!strcmp(funcName, "vkDestroyFence")) return vkDestroyFence;
68     if (!strcmp(funcName, "vkGetFenceStatus")) return vkGetFenceStatus;
69     if (!strcmp(funcName, "vkResetFences")) return vkResetFences;
70     if (!strcmp(funcName, "vkWaitForFences")) return vkWaitForFences;
71     if (!strcmp(funcName, "vkCreateSemaphore")) return vkCreateSemaphore;
72     if (!strcmp(funcName, "vkDestroySemaphore")) return vkDestroySemaphore;
73     if (!strcmp(funcName, "vkCreateEvent")) return vkCreateEvent;
74     if (!strcmp(funcName, "vkDestroyEvent")) return vkDestroyEvent;
75     if (!strcmp(funcName, "vkGetEventStatus")) return vkGetEventStatus;
76     if (!strcmp(funcName, "vkSetEvent")) return vkSetEvent;
77     if (!strcmp(funcName, "vkResetEvent")) return vkResetEvent;
78     if (!strcmp(funcName, "vkCreateQueryPool")) return vkCreateQueryPool;
79     if (!strcmp(funcName, "vkDestroyQueryPool")) return vkDestroyQueryPool;
80     if (!strcmp(funcName, "vkGetQueryPoolResults")) return vkGetQueryPoolResults;
81     if (!strcmp(funcName, "vkCreateBuffer")) return vkCreateBuffer;
82     if (!strcmp(funcName, "vkDestroyBuffer")) return vkDestroyBuffer;
83     if (!strcmp(funcName, "vkCreateBufferView")) return vkCreateBufferView;
84     if (!strcmp(funcName, "vkDestroyBufferView")) return vkDestroyBufferView;
85     if (!strcmp(funcName, "vkCreateImage")) return vkCreateImage;
86     if (!strcmp(funcName, "vkDestroyImage")) return vkDestroyImage;
87     if (!strcmp(funcName, "vkGetImageSubresourceLayout")) return vkGetImageSubresourceLayout;
88     if (!strcmp(funcName, "vkCreateImageView")) return vkCreateImageView;
89     if (!strcmp(funcName, "vkDestroyImageView")) return vkDestroyImageView;
90     if (!strcmp(funcName, "vkCreateShaderModule")) return vkCreateShaderModule;
91     if (!strcmp(funcName, "vkDestroyShaderModule")) return vkDestroyShaderModule;
92     if (!strcmp(funcName, "vkCreatePipelineCache")) return vkCreatePipelineCache;
93     if (!strcmp(funcName, "vkDestroyPipelineCache")) return vkDestroyPipelineCache;
94     if (!strcmp(funcName, "vkGetPipelineCacheData")) return vkGetPipelineCacheData;
95     if (!strcmp(funcName, "vkMergePipelineCaches")) return vkMergePipelineCaches;
96     if (!strcmp(funcName, "vkCreateGraphicsPipelines")) return vkCreateGraphicsPipelines;
97     if (!strcmp(funcName, "vkCreateComputePipelines")) return vkCreateComputePipelines;
98     if (!strcmp(funcName, "vkDestroyPipeline")) return vkDestroyPipeline;
99     if (!strcmp(funcName, "vkCreatePipelineLayout")) return vkCreatePipelineLayout;
100     if (!strcmp(funcName, "vkDestroyPipelineLayout")) return vkDestroyPipelineLayout;
101     if (!strcmp(funcName, "vkCreateSampler")) return vkCreateSampler;
102     if (!strcmp(funcName, "vkDestroySampler")) return vkDestroySampler;
103     if (!strcmp(funcName, "vkCreateDescriptorSetLayout")) return vkCreateDescriptorSetLayout;
104     if (!strcmp(funcName, "vkDestroyDescriptorSetLayout")) return vkDestroyDescriptorSetLayout;
105     if (!strcmp(funcName, "vkCreateDescriptorPool")) return vkCreateDescriptorPool;
106     if (!strcmp(funcName, "vkDestroyDescriptorPool")) return vkDestroyDescriptorPool;
107     if (!strcmp(funcName, "vkResetDescriptorPool")) return vkResetDescriptorPool;
108     if (!strcmp(funcName, "vkAllocateDescriptorSets")) return vkAllocateDescriptorSets;
109     if (!strcmp(funcName, "vkFreeDescriptorSets")) return vkFreeDescriptorSets;
110     if (!strcmp(funcName, "vkUpdateDescriptorSets")) return vkUpdateDescriptorSets;
111     if (!strcmp(funcName, "vkCreateFramebuffer")) return vkCreateFramebuffer;
112     if (!strcmp(funcName, "vkDestroyFramebuffer")) return vkDestroyFramebuffer;
113     if (!strcmp(funcName, "vkCreateRenderPass")) return vkCreateRenderPass;
114     if (!strcmp(funcName, "vkDestroyRenderPass")) return vkDestroyRenderPass;
115     if (!strcmp(funcName, "vkGetRenderAreaGranularity")) return vkGetRenderAreaGranularity;
116     if (!strcmp(funcName, "vkCreateCommandPool")) return vkCreateCommandPool;
117     if (!strcmp(funcName, "vkDestroyCommandPool")) return vkDestroyCommandPool;
118     if (!strcmp(funcName, "vkResetCommandPool")) return vkResetCommandPool;
119     if (!strcmp(funcName, "vkAllocateCommandBuffers")) return vkAllocateCommandBuffers;
120     if (!strcmp(funcName, "vkFreeCommandBuffers")) return vkFreeCommandBuffers;
121     if (!strcmp(funcName, "vkBeginCommandBuffer")) return vkBeginCommandBuffer;
122     if (!strcmp(funcName, "vkEndCommandBuffer")) return vkEndCommandBuffer;
123     if (!strcmp(funcName, "vkResetCommandBuffer")) return vkResetCommandBuffer;
124     if (!strcmp(funcName, "vkCmdBindPipeline")) return vkCmdBindPipeline;
125     if (!strcmp(funcName, "vkCmdBindDescriptorSets")) return vkCmdBindDescriptorSets;
126     if (!strcmp(funcName, "vkCmdBindVertexBuffers")) return vkCmdBindVertexBuffers;
127     if (!strcmp(funcName, "vkCmdBindIndexBuffer")) return vkCmdBindIndexBuffer;
128     if (!strcmp(funcName, "vkCmdSetViewport")) return vkCmdSetViewport;
129     if (!strcmp(funcName, "vkCmdSetScissor")) return vkCmdSetScissor;
130     if (!strcmp(funcName, "vkCmdSetLineWidth")) return vkCmdSetLineWidth;
131     if (!strcmp(funcName, "vkCmdSetDepthBias")) return vkCmdSetDepthBias;
132     if (!strcmp(funcName, "vkCmdSetBlendConstants")) return vkCmdSetBlendConstants;
133     if (!strcmp(funcName, "vkCmdSetDepthBounds")) return vkCmdSetDepthBounds;
134     if (!strcmp(funcName, "vkCmdSetStencilCompareMask")) return vkCmdSetStencilCompareMask;
135     if (!strcmp(funcName, "vkCmdSetStencilWriteMask")) return vkCmdSetStencilWriteMask;
136     if (!strcmp(funcName, "vkCmdSetStencilReference")) return vkCmdSetStencilReference;
137     if (!strcmp(funcName, "vkCmdDraw")) return vkCmdDraw;
138     if (!strcmp(funcName, "vkCmdDrawIndexed")) return vkCmdDrawIndexed;
139     if (!strcmp(funcName, "vkCmdDrawIndirect")) return vkCmdDrawIndirect;
140     if (!strcmp(funcName, "vkCmdDrawIndexedIndirect")) return vkCmdDrawIndexedIndirect;
141     if (!strcmp(funcName, "vkCmdDispatch")) return vkCmdDispatch;
142     if (!strcmp(funcName, "vkCmdDispatchIndirect")) return vkCmdDispatchIndirect;
143     if (!strcmp(funcName, "vkCmdCopyBuffer")) return vkCmdCopyBuffer;
144     if (!strcmp(funcName, "vkCmdCopyImage")) return vkCmdCopyImage;
145     if (!strcmp(funcName, "vkCmdBlitImage")) return vkCmdBlitImage;
146     if (!strcmp(funcName, "vkCmdCopyBufferToImage")) return vkCmdCopyBufferToImage;
147     if (!strcmp(funcName, "vkCmdCopyImageToBuffer")) return vkCmdCopyImageToBuffer;
148     if (!strcmp(funcName, "vkCmdUpdateBuffer")) return vkCmdUpdateBuffer;
149     if (!strcmp(funcName, "vkCmdFillBuffer")) return vkCmdFillBuffer;
150     if (!strcmp(funcName, "vkCmdClearColorImage")) return vkCmdClearColorImage;
151     if (!strcmp(funcName, "vkCmdClearDepthStencilImage")) return vkCmdClearDepthStencilImage;
152     if (!strcmp(funcName, "vkCmdClearAttachments")) return vkCmdClearAttachments;
153     if (!strcmp(funcName, "vkCmdResolveImage")) return vkCmdResolveImage;
154     if (!strcmp(funcName, "vkCmdSetEvent")) return vkCmdSetEvent;
155     if (!strcmp(funcName, "vkCmdResetEvent")) return vkCmdResetEvent;
156     if (!strcmp(funcName, "vkCmdWaitEvents")) return vkCmdWaitEvents;
157     if (!strcmp(funcName, "vkCmdPipelineBarrier")) return vkCmdPipelineBarrier;
158     if (!strcmp(funcName, "vkCmdBeginQuery")) return vkCmdBeginQuery;
159     if (!strcmp(funcName, "vkCmdEndQuery")) return vkCmdEndQuery;
160     if (!strcmp(funcName, "vkCmdResetQueryPool")) return vkCmdResetQueryPool;
161     if (!strcmp(funcName, "vkCmdWriteTimestamp")) return vkCmdWriteTimestamp;
162     if (!strcmp(funcName, "vkCmdCopyQueryPoolResults")) return vkCmdCopyQueryPoolResults;
163     if (!strcmp(funcName, "vkCmdPushConstants")) return vkCmdPushConstants;
164     if (!strcmp(funcName, "vkCmdBeginRenderPass")) return vkCmdBeginRenderPass;
165     if (!strcmp(funcName, "vkCmdNextSubpass")) return vkCmdNextSubpass;
166     if (!strcmp(funcName, "vkCmdEndRenderPass")) return vkCmdEndRenderPass;
167     if (!strcmp(funcName, "vkCmdExecuteCommands")) return vkCmdExecuteCommands;
168 
169     // Core 1.1 functions
170     if (!strcmp(funcName, "vkEnumeratePhysicalDeviceGroups")) return vkEnumeratePhysicalDeviceGroups;
171     if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures2")) return vkGetPhysicalDeviceFeatures2;
172     if (!strcmp(funcName, "vkGetPhysicalDeviceProperties2")) return vkGetPhysicalDeviceProperties2;
173     if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties2")) return vkGetPhysicalDeviceFormatProperties2;
174     if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties2")) return vkGetPhysicalDeviceImageFormatProperties2;
175     if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties2")) return vkGetPhysicalDeviceQueueFamilyProperties2;
176     if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties2")) return vkGetPhysicalDeviceMemoryProperties2;
177     if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties2"))
178         return vkGetPhysicalDeviceSparseImageFormatProperties2;
179     if (!strcmp(funcName, "vkGetPhysicalDeviceExternalBufferProperties")) return vkGetPhysicalDeviceExternalBufferProperties;
180     if (!strcmp(funcName, "vkGetPhysicalDeviceExternalSemaphoreProperties")) return vkGetPhysicalDeviceExternalSemaphoreProperties;
181     if (!strcmp(funcName, "vkGetPhysicalDeviceExternalFenceProperties")) return vkGetPhysicalDeviceExternalFenceProperties;
182     if (!strcmp(funcName, "vkBindBufferMemory2")) return vkBindBufferMemory2;
183     if (!strcmp(funcName, "vkBindImageMemory2")) return vkBindImageMemory2;
184     if (!strcmp(funcName, "vkGetDeviceGroupPeerMemoryFeatures")) return vkGetDeviceGroupPeerMemoryFeatures;
185     if (!strcmp(funcName, "vkCmdSetDeviceMask")) return vkCmdSetDeviceMask;
186     if (!strcmp(funcName, "vkCmdDispatchBase")) return vkCmdDispatchBase;
187     if (!strcmp(funcName, "vkGetImageMemoryRequirements2")) return vkGetImageMemoryRequirements2;
188     if (!strcmp(funcName, "vkTrimCommandPool")) return vkTrimCommandPool;
189     if (!strcmp(funcName, "vkGetDeviceQueue2")) return vkGetDeviceQueue2;
190     if (!strcmp(funcName, "vkCreateSamplerYcbcrConversion")) return vkCreateSamplerYcbcrConversion;
191     if (!strcmp(funcName, "vkDestroySamplerYcbcrConversion")) return vkDestroySamplerYcbcrConversion;
192     if (!strcmp(funcName, "vkGetDescriptorSetLayoutSupport")) return vkGetDescriptorSetLayoutSupport;
193     if (!strcmp(funcName, "vkCreateDescriptorUpdateTemplate")) return vkCreateDescriptorUpdateTemplate;
194     if (!strcmp(funcName, "vkDestroyDescriptorUpdateTemplate")) return vkDestroyDescriptorUpdateTemplate;
195     if (!strcmp(funcName, "vkUpdateDescriptorSetWithTemplate")) return vkUpdateDescriptorSetWithTemplate;
196     if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements2")) return vkGetImageSparseMemoryRequirements2;
197     if (!strcmp(funcName, "vkGetBufferMemoryRequirements2")) return vkGetBufferMemoryRequirements2;
198 
199     // Core 1.2 functions
200     if (!strcmp(funcName, "vkCreateRenderPass2")) return vkCreateRenderPass2;
201     if (!strcmp(funcName, "vkCmdBeginRenderPass2")) return vkCmdBeginRenderPass2;
202     if (!strcmp(funcName, "vkCmdNextSubpass2")) return vkCmdNextSubpass2;
203     if (!strcmp(funcName, "vkCmdEndRenderPass2")) return vkCmdEndRenderPass2;
204     if (!strcmp(funcName, "vkCmdDrawIndirectCount")) return vkCmdDrawIndirectCount;
205     if (!strcmp(funcName, "vkCmdDrawIndexedIndirectCount")) return vkCmdDrawIndexedIndirectCount;
206     if (!strcmp(funcName, "vkGetSemaphoreCounterValue")) return vkGetSemaphoreCounterValue;
207     if (!strcmp(funcName, "vkWaitSemaphores")) return vkWaitSemaphores;
208     if (!strcmp(funcName, "vkSignalSemaphore")) return vkSignalSemaphore;
209     if (!strcmp(funcName, "vkGetBufferDeviceAddress")) return vkGetBufferDeviceAddress;
210     if (!strcmp(funcName, "vkGetBufferOpaqueCaptureAddress")) return vkGetBufferOpaqueCaptureAddress;
211     if (!strcmp(funcName, "vkGetDeviceMemoryOpaqueCaptureAddress")) return vkGetDeviceMemoryOpaqueCaptureAddress;
212     if (!strcmp(funcName, "vkResetQueryPool")) return vkResetQueryPool;
213 
214     // Core 1.3 functions
215     if (!strcmp(funcName, "vkGetPhysicalDeviceToolProperties")) return vkGetPhysicalDeviceToolProperties;
216     if (!strcmp(funcName, "vkCreatePrivateDataSlot")) return vkCreatePrivateDataSlot;
217     if (!strcmp(funcName, "vkDestroyPrivateDataSlot")) return vkDestroyPrivateDataSlot;
218     if (!strcmp(funcName, "vkSetPrivateData")) return vkSetPrivateData;
219     if (!strcmp(funcName, "vkGetPrivateData")) return vkGetPrivateData;
220     if (!strcmp(funcName, "vkCmdSetEvent2")) return vkCmdSetEvent2;
221     if (!strcmp(funcName, "vkCmdResetEvent2")) return vkCmdResetEvent2;
222     if (!strcmp(funcName, "vkCmdWaitEvents2")) return vkCmdWaitEvents2;
223     if (!strcmp(funcName, "vkCmdPipelineBarrier2")) return vkCmdPipelineBarrier2;
224     if (!strcmp(funcName, "vkCmdWriteTimestamp2")) return vkCmdWriteTimestamp2;
225     if (!strcmp(funcName, "vkQueueSubmit2")) return vkQueueSubmit2;
226     if (!strcmp(funcName, "vkCmdCopyBuffer2")) return vkCmdCopyBuffer2;
227     if (!strcmp(funcName, "vkCmdCopyImage2")) return vkCmdCopyImage2;
228     if (!strcmp(funcName, "vkCmdCopyBufferToImage2")) return vkCmdCopyBufferToImage2;
229     if (!strcmp(funcName, "vkCmdCopyImageToBuffer2")) return vkCmdCopyImageToBuffer2;
230     if (!strcmp(funcName, "vkCmdBlitImage2")) return vkCmdBlitImage2;
231     if (!strcmp(funcName, "vkCmdResolveImage2")) return vkCmdResolveImage2;
232     if (!strcmp(funcName, "vkCmdBeginRendering")) return vkCmdBeginRendering;
233     if (!strcmp(funcName, "vkCmdEndRendering")) return vkCmdEndRendering;
234     if (!strcmp(funcName, "vkCmdSetCullMode")) return vkCmdSetCullMode;
235     if (!strcmp(funcName, "vkCmdSetFrontFace")) return vkCmdSetFrontFace;
236     if (!strcmp(funcName, "vkCmdSetPrimitiveTopology")) return vkCmdSetPrimitiveTopology;
237     if (!strcmp(funcName, "vkCmdSetViewportWithCount")) return vkCmdSetViewportWithCount;
238     if (!strcmp(funcName, "vkCmdSetScissorWithCount")) return vkCmdSetScissorWithCount;
239     if (!strcmp(funcName, "vkCmdBindVertexBuffers2")) return vkCmdBindVertexBuffers2;
240     if (!strcmp(funcName, "vkCmdSetDepthTestEnable")) return vkCmdSetDepthTestEnable;
241     if (!strcmp(funcName, "vkCmdSetDepthWriteEnable")) return vkCmdSetDepthWriteEnable;
242     if (!strcmp(funcName, "vkCmdSetDepthCompareOp")) return vkCmdSetDepthCompareOp;
243     if (!strcmp(funcName, "vkCmdSetDepthBoundsTestEnable")) return vkCmdSetDepthBoundsTestEnable;
244     if (!strcmp(funcName, "vkCmdSetStencilTestEnable")) return vkCmdSetStencilTestEnable;
245     if (!strcmp(funcName, "vkCmdSetStencilOp")) return vkCmdSetStencilOp;
246     if (!strcmp(funcName, "vkCmdSetRasterizerDiscardEnable")) return vkCmdSetRasterizerDiscardEnable;
247     if (!strcmp(funcName, "vkCmdSetDepthBiasEnable")) return vkCmdSetDepthBiasEnable;
248     if (!strcmp(funcName, "vkCmdSetPrimitiveRestartEnable")) return vkCmdSetPrimitiveRestartEnable;
249     if (!strcmp(funcName, "vkGetDeviceBufferMemoryRequirements")) return vkGetDeviceBufferMemoryRequirements;
250     if (!strcmp(funcName, "vkGetDeviceImageMemoryRequirements")) return vkGetDeviceImageMemoryRequirements;
251     if (!strcmp(funcName, "vkGetDeviceImageSparseMemoryRequirements")) return vkGetDeviceImageSparseMemoryRequirements;
252 
253     // Instance extensions
254     void *addr;
255     if (debug_extensions_InstanceGpa(inst, funcName, &addr)) return addr;
256 
257     if (wsi_swapchain_instance_gpa(inst, funcName, &addr)) return addr;
258 
259     if (extension_instance_gpa(inst, funcName, &addr)) return addr;
260 
261     // Unknown physical device extensions
262     addr = loader_phys_dev_ext_gpa_tramp(inst, funcName);
263     if (NULL != addr) return addr;
264 
265     // Unknown device extensions
266     addr = loader_dev_ext_gpa_tramp(inst, funcName);
267     return addr;
268 }
269 
globalGetProcAddr(const char * name)270 void *globalGetProcAddr(const char *name) {
271     if (!name || name[0] != 'v' || name[1] != 'k') return NULL;
272 
273     name += 2;
274     if (!strcmp(name, "CreateInstance")) return vkCreateInstance;
275     if (!strcmp(name, "EnumerateInstanceExtensionProperties")) return vkEnumerateInstanceExtensionProperties;
276     if (!strcmp(name, "EnumerateInstanceLayerProperties")) return vkEnumerateInstanceLayerProperties;
277     if (!strcmp(name, "EnumerateInstanceVersion")) return vkEnumerateInstanceVersion;
278 
279     return NULL;
280 }
281 
loader_non_passthrough_gdpa(const char * name)282 void *loader_non_passthrough_gdpa(const char *name) {
283     if (!name || name[0] != 'v' || name[1] != 'k') return NULL;
284 
285     name += 2;
286 
287     if (!strcmp(name, "GetDeviceProcAddr")) return vkGetDeviceProcAddr;
288     if (!strcmp(name, "DestroyDevice")) return vkDestroyDevice;
289     if (!strcmp(name, "GetDeviceQueue")) return vkGetDeviceQueue;
290     if (!strcmp(name, "GetDeviceQueue2")) return vkGetDeviceQueue2;
291     if (!strcmp(name, "AllocateCommandBuffers")) return vkAllocateCommandBuffers;
292 
293     return NULL;
294 }
295