[Mesa-dev] [PATCH] st/nine: specify WINAPI only for i386 and amd64
Christian Schmidbauer
ch.schmidbauer at gmail.com
Mon Mar 21 14:30:32 UTC 2016
On Mon, Mar 21, 2016 at 2:10 PM, Steven Newbury <steve at snewbury.org.uk> wrote:
> On Thu, 2016-03-17 at 20:12 +0100, Christian Schmidbauer wrote:
>> Currently mesa fails building with the x32 abi as ms_abi is not
>> defined
>> in such a case.
>>
>> The patch uses ms_abi only for amd64 targets and stdcall only for
>> i386
>> targets to be sure that those are defined.
>>
> Being quite involved with with getting things to build on x32 I have
> encountered this. The patch looks correct
>
> Does an x32 build of st/nine make any sense? As far as I know, st/nine
> deliberately works only with Wine which only exists in x86 and amd64
> flavours (amd ARM?), or unless this has changed and there's an
> intention of creating a native d3d9 library wouldn't it be better to
> simply prevent st/nine being built at configure time on unusable
> targets?
>
> Or does an x32 build work with Windows x64 binaries? I've never tried.
>
I have a multilib setup (i386, amd64, x32) where some packages like
mesa are built for all abis; that's where I encountered the issue.
After applying the patch, I "verified" that nine is working by
building and running Xnine ( https://github.com/axeldavy/Xnine ) for
x32. It worked just fine.
>> This patch additionally checks for __GNUC__ to guarantee that
>> __attribute__ is available.
>> ---
>> include/D3D9/d3d9types.h | 16 +++++++++++-----
>> 1 file changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/D3D9/d3d9types.h b/include/D3D9/d3d9types.h
>> index d74ce80..e0b8652 100644
>> --- a/include/D3D9/d3d9types.h
>> +++ b/include/D3D9/d3d9types.h
>> @@ -178,11 +178,17 @@ typedef struct _RGNDATA {
>> #undef WINAPI
>> #endif /* WINAPI*/
>>
>> -#if defined(__x86_64__) || defined(_M_X64)
>> -#define WINAPI __attribute__((ms_abi))
>> -#else /* x86_64 */
>> -#define WINAPI __attribute__((__stdcall__))
>> -#endif /* x86_64 */
>> +#ifdef __GNUC__
>> + #if (defined(__x86_64__) && !defined(__ILP32__)) ||
>> defined(_M_X64)
>> + #define WINAPI __attribute__((ms_abi))
>> + #elif defined(__i386) || defined(_M_IX86)
>> + #define WINAPI __attribute__((__stdcall__))
>> + #else /* neither amd64 nor i386 */
>> + #define WINAPI
>> + #endif
>> +#else /* __GNUC__ */
>> + #define WINAPI
>> +#endif
>>
>> /* Implementation caps */
>> #define D3DPRESENT_BACK_BUFFERS_MAX 3
More information about the mesa-dev
mailing list