vulkan: Fix entrypoint generation when compiling for x86 with MSVC

When compiling for x86 with MSVC, Vulkan API entry points follow the
__stdcall convention (VKAPI_CALL maps to __stdcall), which uses the
following name mangling:

   _<function_name>@<arguments_size>

Fix the vk_entrypoint_stub()/alternatename definitions accordingly.

Fixes: 6d44b21d4f ("vulkan: Fix weak symbol emulation when compiling with MSVC")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13516>
(cherry picked from commit 1813bb5917)
This commit is contained in:
Boris Brezillon 2021-10-25 18:37:21 +02:00 committed by Eric Engestrom
parent 734011012f
commit a63104a7d8
3 changed files with 4 additions and 4 deletions

View file

@ -562,7 +562,7 @@
"description": "vulkan: Fix entrypoint generation when compiling for x86 with MSVC",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "6d44b21d4fdea89673541de265f69258747c5499"
},

View file

@ -69,7 +69,7 @@ extern "C" {
#endif
#ifdef _MSC_VER
void vk_entrypoint_stub(void);
VKAPI_ATTR void VKAPI_CALL vk_entrypoint_stub(void);
#endif
<%def name="dispatch_table(entrypoints)">
@ -469,7 +469,7 @@ vk_device_entrypoint_is_enabled(int index, uint32_t core_version,
}
#ifdef _MSC_VER
void vk_entrypoint_stub(void)
VKAPI_ATTR void VKAPI_CALL vk_entrypoint_stub(void)
{
unreachable(!"Entrypoint not implemented");
}

View file

@ -125,7 +125,7 @@ TEMPLATE_C = Template(COPYRIGHT + """
#ifdef _MSC_VER
#ifdef _M_IX86
% for args_size in [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 60, 104]:
#pragma comment(linker, "/alternatename:_${p}_${e.name}@${args_size}=_vk_entrypoint_stub")
#pragma comment(linker, "/alternatename:_${p}_${e.name}@${args_size}=_vk_entrypoint_stub@0")
% endfor
#else
#pragma comment(linker, "/alternatename:${p}_${e.name}=vk_entrypoint_stub")