protonscr

The check for 64bit platform in vkd3d_atomic.h is not exhausting causing vkd3d_atomic_uint32 to be used on aarch64

vkd3dclosed
HansKristian-Work/vkd3d-proton#830 · opened 2021-10-04 by werman · updated 2021-10-05 · 6 comments · github
Wwerman 2021-10-04 github

https://github.com/HansKristian-Work/vkd3d-proton/blob/d9cd18b1cad4a15847ebe639fddb5478fc3909d0/include/private/vkd3d_atomic.h#L265-L267

Correctly using 64bit atomics on aarch64 is enough to successfully run triangle and gears demos on Turnip (with patches).

HHansKristian-Work maintainer 2021-10-04 github

Please PR, we cannot test on this platform.

Mmisyltoad maintainer 2021-10-04 github

Probably worth making a generic thing that does (sizeof(void *) == 8 ? vkd3d_atomic_uint64_store_explicit(...) : vkd3d_atomic_uint32_store_explicit(...))

HHansKristian-Work maintainer 2021-10-04 github

Should be possible to use SIZE_T_MAX or something perhaps ...

Wwerman 2021-10-04 github

I have #if (INTPTR_MAX == INT64_MAX) at the moment

Mmisyltoad maintainer 2021-10-04 github

You should also fix vkd3d_bitmask_tzcnt64, as _BitScanForward64 is available on AARCH64 on Windows under MSVC.

Wwerman 2021-10-05 github

You should also fix vkd3d_bitmask_tzcnt64, as _BitScanForward64 is available on AARCH64 on Windows under MSVC.

Per https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-160:

_WIN64 Defined as 1 when the compilation target is 64-bit ARM or x64. Otherwise, undefined.

So this case is already covered.

Nothing extracted yet.