From: Henri Verbeet Subject: Re: [PATCH 04/10] winevulkan: Implement global Vulkan function stubs and loading. Message-Id: Date: Wed, 21 Feb 2018 15:52:26 +0330 In-Reply-To: <20180220062947.4192-5-thunderbird2k@gmail.com> References: <20180220062947.4192-1-thunderbird2k@gmail.com> <20180220062947.4192-5-thunderbird2k@gmail.com> On 20 February 2018 at 09:59, Roderick Colenbrander wrote: > +static void *wine_vk_get_global_proc_addr(const char *name) > +{ > + int i; > + for (i = 0; i < sizeof(vk_global_dispatch_table) / sizeof(vk_global_dispatch_table[0]); i++) You'll probably want to introduce and use an ARRAY_SIZE macro, like we've been doing in several other places. Chances are it will become globally available fairly soon. I'd also argue for making integers unsigned unless there's a reason to make them signed. > + { > + if (strcmp(name, vk_global_dispatch_table[i].name) == 0) > + { > + TRACE("Found pName=%s in global table\n", name); "debugstr_a(name)" > +static PFN_vkVoidFunction WINAPI wine_vkGetInstanceProcAddr(VkInstance instance, const char *pName) > { > - FIXME("stub: %p %s\n", instance, debugstr_a(pName)); > + void *func; > + TRACE("%p %s\n", instance, debugstr_a(pName)); > + > + /* vkGetInstanceProcAddr can load most Vulkan functions when an instance is passed in, however > + * for a NULL instance it can only load global functions. > + */ > + func = wine_vk_get_global_proc_addr(pName); > + if (func) > + { > + return func; > + } > + else if (!instance && !func) Also pretty minor, but "else" and "!func" are redundant here, since we'd have returned above for any non-NULL "func".