[PATCH 04/10] winevulkan: Implement global Vulkan function stubs and loading.
Henri Verbeet
hverbeet at gmail.com
Wed Feb 21 06:22:26 CST 2018
On 20 February 2018 at 09:59, Roderick Colenbrander
<thunderbird2k at gmail.com> 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".
More information about the wine-devel
mailing list