vulkan: Support 32-bit "weak" symbols on MSVC
MSVC uses different decorated names for 32-bit versus 64-bit. Declare
all argument sizes for 32-bit because computing the actual size would be
difficult.
Fixes: 9be7aa3fc8
("vulkan: Add a common entrypoint table generator")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10573>
This commit is contained in:
parent
a5a86adc23
commit
fb7be7870c
|
@ -109,6 +109,10 @@ TEMPLATE_C = Template(COPYRIGHT + """
|
||||||
/* Weak aliases for all potential implementations. These will resolve to
|
/* Weak aliases for all potential implementations. These will resolve to
|
||||||
* NULL if they're not defined, which lets the resolve_entrypoint() function
|
* NULL if they're not defined, which lets the resolve_entrypoint() function
|
||||||
* either pick the correct entry point.
|
* either pick the correct entry point.
|
||||||
|
*
|
||||||
|
* MSVC uses different decorated names for 32-bit versus 64-bit. Declare
|
||||||
|
* all argument sizes for 32-bit because computing the actual size would be
|
||||||
|
* difficult.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
<%def name="entrypoint_table(type, entrypoints, prefixes)">
|
<%def name="entrypoint_table(type, entrypoints, prefixes)">
|
||||||
|
@ -119,10 +123,14 @@ TEMPLATE_C = Template(COPYRIGHT + """
|
||||||
% endif
|
% endif
|
||||||
% for p in prefixes:
|
% for p in prefixes:
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma comment(linker, "/alternatename:${p}_${e.name}_Weak=${p}_${e.name}_Null")
|
|
||||||
#pragma comment(linker, "/alternatename:${p}_${e.name}=${p}_${e.name}_Weak")
|
|
||||||
${e.return_type} (*${p}_${e.name}_Null)(${e.decl_params()}) = 0;
|
${e.return_type} (*${p}_${e.name}_Null)(${e.decl_params()}) = 0;
|
||||||
${e.return_type} ${p}_${e.name}_Weak(${e.decl_params()});
|
#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}=_${p}_${e.name}_Null")
|
||||||
|
% endfor
|
||||||
|
#else
|
||||||
|
#pragma comment(linker, "/alternatename:${p}_${e.name}=${p}_${e.name}_Null")
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
VKAPI_ATTR ${e.return_type} VKAPI_CALL ${p}_${e.name}(${e.decl_params()}) __attribute__ ((weak));
|
VKAPI_ATTR ${e.return_type} VKAPI_CALL ${p}_${e.name}(${e.decl_params()}) __attribute__ ((weak));
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue